tuupola / lazyload

Vanilla JavaScript plugin for lazyloading images
https://appelsiini.net/projects/lazyload/
MIT License
8.76k stars 2.23k forks source link

Does lazyload support <picture> source media? #447

Open eugenyshiryaev opened 4 years ago

eugenyshiryaev commented 4 years ago

`

<img src="/images/1x1.png" class="lazyload" data-src="/img/1.jpg" style="width: 100%;" height="100%">

`

How to make 1_small.png lazyload?

Knyaz71 commented 3 years ago

Попробовать заменить в 120 строке: } else { на } else if ("source" === entry.target.tagName.toLowerCase()) { if (srcset) { entry.target.srcset = srcset; } } else {

и в 145 строке: } else { на } else if ("source" === image.tagName.toLowerCase()) { if (srcset) { image.srcset = srcset; } } else {

passioneight commented 2 years ago

Doesn't seem like it does. Any chance we can get support for this?

Update: if anyone else comes across this - here's an alternative: https://github.com/verlok/vanilla-lazyload