4 ms·
This is not what the article or the implementation does at all. This article/repo is arguably misnamed so I understand your confusion. The technique here is a
by andy_ppp 11y ago
This is not what the article or the implementation does at all. This article/repo is arguably misnamed so I understand your confusion.
The technique here is an excellent way to load only the right size images for different devices.
It works in about 65% of browsers and has excellent fallback characteristics in others.
Read the bottom of the blogpost here for details:
http://ivopetkov.com/b/lazy-load-responsive-images/ http://ivopetkov.com/b/lazy-load-responsive-images/
P.S. I'm totally with you on pointless lazy-loading - the browser should figure out what is sensible to load based on available bandwidth and where I have scrolled to...
- voyou 11y agoFrom that link: "Lazy loading is a technique that defers image loading until it becomes visible on the screen." Isn't this exactly the "pointless lazy-loading" that you and the OP are complaining about? If what you want is to "load only the right size images for different devices," and you're targeting browsers that support srcset, you can just use srcset.
- andy_ppp 11y agoWell I think this looks pretty good, the only issue is modern browsers without Javascript. It provides a lot of fallbacks that srcset does not on it's own. No, it's not pointless; I think it's actually quite useful if you rely on Javascript, which some say is the worst thing in the world... but after using React I've been persuaded for complex interfaces it can provide clear advantages over progressive enhancement.
- ad-hominem 11y ago> modern browsers without Javascript Sorry, what browsers? There is no such thing. Even virtually everyone's phone runs javascript. The only way you are running a modern browser without JS is if you've (as a power-user) turned it off. In which case you need to turn it back on when you encounter weirdness on a website that expects that your browser behaves like a normal modern browser. If you run your browser without JS (like I do), then you encounter this situation frequently and it's part of the tradeoff of controlling exactly what code runs during your web experience.