Adding img placeholder to picture tag causes lazy loading to fail.
See original GitHub issueI’m trying to use lozad with a picture tag and and img placeholder like described in documentation:
<picture class="lozad">
<source srcset="some-image.webp" type="image/webp">
<source srcset="some-other-image.jpeg" type="image/jpeg">
<img src="data:image/jpeg;base64,/some_lqip_in_base_64==">
</picture
Without the img placeholder, it works fine, but adding an img
tag actually causes all images to be loaded (even if not within viewport) like when not using lozad at all (except the picture tag gets data-loaded=true
).
I’m using Chrome Version 92.0.4515.107
(64 bits) and I’m on Ubuntu 21.04
.
Am I doing anything wrong here ?
Issue Analytics
- State:
- Created 2 years ago
- Reactions:5
- Comments:6
Top Results From Across the Web
Lazy Loading Images – The Complete Guide - ImageKit.io
The general concept of lazy loading images in <img> tag Lazy loading images can be broken down into two steps: Step one is...
Read more >Lazy loading best practices - web.dev
While lazy loading images and video have positive and measurable performance benefits, it's not a task to be taken lightly.
Read more >Preventing Content Reflow From Lazy-Loaded Images
When a user scrolls and images are lazy-loaded, those img elements go from a height of 0 pixels to whatever they need to...
Read more >Source placeholder for lazy loading images - Stack Overflow
Note: For SEO purposes the element must be an img . Also my HTML must be valid, so a src attribute is required....
Read more >Lazy Loading of Images & How it Helps Websites for SEO?
When images fail to load, you need to be ready with a contingency plan. For example, you have a user who has left...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Try this one https://github.com/verlok/vanilla-lazyload Works fine with picture + img, the setup script is almost the same
any suggestion?