On Github epam-front-end-school-lectures / front-end-performance
<link rel="prefetch" href="/my-next-page.htm">
<link rel="prerender" href="http://mydomain.com/my-next-page.htm">
.page-home { background-image:url(home.jpg); }
.page-about { background-image:url(about.jpg); }
.page-portfolio { background-image:url(portfolio.jpg); }
.page-contact { background-image:url(contact.jpg); }
<link rel="prefetch" href="sprite.png">
@media only screen and (-Webkit-min-device-pixel-ratio: 1.5),
only screen and (-moz-min-device-pixel-ratio: 1.5),
only screen and (-o-min-device-pixel-ratio: 3/2),
only screen and (min-device-pixel-ratio: 1.5) {
.icon {
background-image: url(example@2x.png);
}
}
<figure>
<picture>
<source srcset="/image.png" media="(min-width: 900px)">
<source srcset="/image-240-180.jpg,
/image.jpg 2x" media="(min-width: 450px)">
<img src="http://site.ru/image-120-90.jpg" srcset="/image-240-180.jpg 2x" alt="" title="" longdesc="">
</picture>
<figcaption>Signature</figcaption>
</figure>
*{
translateZ();
translate3d();
}
*{
will-change: transform, opacity;
}
*, *::before, *::after {
will-change: all;
}
.element:hover {
will-change: transform;
transition: transform 2s;
transform: rotate(30deg) scale(1.5);
}
.element { transition: transform 1s ease-out; }
.element:hover { will-change: transform; }
.element:active { transform: rotateY(180deg); }
.element { transition: opacity .3s linear; }
.ancestor:hover .element { will-change: opacity; }
.element:hover { opacity: .5; }
var el = document.getElementById('element');
el.addEventListener('mouseenter', hintBrowser);
el.addEventListener('animationEnd', removeHint);
function hintBrowser() {
this.style.willChange = 'transform, opacity';
}
function removeHint() {
this.style.willChange = 'auto';
}