dinbror / blazy

Hey, be lazy! bLazy.JS is a lightweight pure JavaScript script for lazy loading and multi-serving images. It's working in all modern browsers including IE7+.
http://dinbror.dk/blazy
MIT License
2.63k stars 356 forks source link

bLazy with removed and added dom elements #126

Open dkeulen opened 7 years ago

dkeulen commented 7 years ago

Hi there,

tldr: How do i use bLazy with elements that get removed and/or added to the dom?

First, thanks allot for a pure js lazyload script. Second, i have run into a problem and that problem is:

bLazy works great, except when i use a filter function to remove the element containing the image from the dom, and it gets added again when the filter requirement is met, the data-src does not get assigned to the src attribute.

Any idea what/why this is happening and how to counter this? The only solution i can think of now, is to trigger the bLazy function everytime i press a filter button.

dinbror commented 7 years ago

Hi @dkeulen.

I have it on my feature list, to auto detect async images. In the meantime you can call one of the public functions that comes with blazy, revalidate or load (http://dinbror.dk/blog/blazy/#Functions).

valeriosillari commented 7 years ago

got same issue: appended new markup via ajax to the page and I wpuld like to init again blazy for the images in the new markup.

Waiting updates :)