© 2026 LinearBytes Inc.
Search posts, tags, users, and pages
Eric Kwoka
Or just add loading="lazy" to the images.
loading="lazy"
Then you don't need any css or js
David Jaja
A frontend developer passionate about making topics easily comprehensible to beginners.
Yeah, but using loading="lazy" isn't as flexible as using JavaScript's Intersection Observer to lazy-load images. Thanks for the feedback.👍
David Jaja I disagree. It's much better, as it will adjust it's behavior based on the users devices settings (data/battery saver) and current network connection.
And it works beautifully with srcset and picture element, SEO, etc.
Eric Kwoka Well, there are a variety of ways you can implement image lazy-loading, whatever method you choose is entirely up to you.