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

Invisibility evaluate accurately #109

Open vinzid opened 7 years ago

vinzid commented 7 years ago

Originally, the visibility of the lazy load element is determined base on weather the width or height of the element is 0, but if the placeholder image has not loaded, the width or height can be 0, so I bind the loadElement to the load event of the element to evaluate accurately after the placeholder image loaded. This phenomenon is not frequent, but it deed happen periodically. So it's not easy to discover, but I think it should fixed for the stability of this plugin.

dinbror commented 7 years ago

Hi @vinzid

Thanks for your PR. I always reserve space for the images I want to lazyload, this will ensure that your issue wont happen and that the document will not have to repaint all the time.