question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Adding img placeholder to picture tag causes lazy loading to fail.

See original GitHub issue

I’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:open
  • Created 2 years ago
  • Reactions:5
  • Comments:6

github_iconTop GitHub Comments

1reaction
galetahubcommented, Apr 13, 2022

Try this one https://github.com/verlok/vanilla-lazyload Works fine with picture + img, the setup script is almost the same

0reactions
saiballocommented, Feb 25, 2022

any suggestion?

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found