During image init, srcset should not be set on page load, but only when lightbox effect is called. data-srcset should be used, only only when image is loading, only then set it.
Right now having lots of 2x images for retina, browser will pre-load it even if user will not use lightbox.
During image init,
srcset
should not be set on page load, but only when lightbox effect is called.data-srcset
should be used, only only when image is loading, only then set it.Right now having lots of 2x images for retina, browser will pre-load it even if user will not use lightbox.
Test case:
All 3
https://via.placeholder.com/1200.jpg
will be preloaded, which is wrong. Imagine page has 83 retina images.