scottjehl / picturefill

A responsive image polyfill for <picture>, srcset, sizes, and more
http://scottjehl.github.com/picturefill/
MIT License
9.88k stars 1.07k forks source link

Safari - Images don't load after appending by infinite scroll #687

Closed tiagogon closed 2 years ago

tiagogon commented 7 years ago

I am using on my website the infinite-scroll.com.

Everything works fine on Chrome and Firefox.

But on Safari once the thumbnails are appended, the images do not load.

You can see it on this images or live here.

screen shot 2017-07-21 at 20 06 30

does anyone know how to solve this?

I thank you in advance!

tiagogon commented 7 years ago

I got this contribution:

$container.on( 'append.infiniteScroll', function(){
  picturefill();
});

but still does not work.

modeckimellett commented 7 years ago

I was seeing a similar issue in Chrome and Firefox with appended content. I was able to force a redraw by firing a fake window resize event. I used the following:

var resizeEvent = window.document.createEvent('UIEvents'); 
resizeEvent .initUIEvent('resize', true, false, window, 0); 
window.dispatchEvent(resizeEvent);

From this StackOverflow answer: https://stackoverflow.com/a/1818513/1007661

I tried this because of the info regarding deferred loading at the end of an old version of the README: https://github.com/scottjehl/picturefill/blob/a3344289ea535b58cb2460fed62c65e15deb1068/README.md

Note that I'm still on v2.3.1 of picturefill. So you might see different results.

tiagogon commented 7 years ago

still doesn't work on my case.

modeckimellett commented 7 years ago

I checked for differences and my use case is different from yours. I'm using the <picture> syntax to provide completely different pictures at different screen sizes. It looks like you're using the <img srcset size> syntax. I guess the fix I have only works with the <picture> syntax which seems odd.