lozad.js
lozad.js copied to clipboard
Improvement
Hi @ApoorvSaxena ,
I've just discovered an other library using intersection observer to lazyload image with some interesting approach.
You should have a look to the code some part of it could be interesting to improve lozad.js 😄
https://github.com/marlospomin/turtle/blob/master/src/turtle.js
Cheers
@jimblue , what parts are you specifically mentioning of?
How it load image here: https://github.com/marlospomin/turtle/blob/e0b07b186c08c8041771ac9df233adc6f2143980/src/turtle.js#L33
What @jimblue mentions is true, the lozad library isn't preloading images, only settings attributes and acting accordingly. For example, loaded classes are set even when the image itself isn't loaded at all, yet. Preloading the src makes sense, really.