callmecavs / layzr.js

A modern lazy loading library for images.

Home Page:http://callmecavs.com/layzr.js/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Dynamically displayed images require a scroll to fire layzr

Subfader opened this issue · comments

I have images that I display on click. But I need to animate a scroll to fire layzr.

How can this be avoided?

http://jsfiddle.net/L69tLkom/

I'm doing manual attribute swapping for src on click now.

Would be good to know nontheless, it's a bug imo.

tho its usually called via the scroll handler, you can call the update function on your instance manually when you add the image source. let me know how it works out for you

// create your instance (you only need 1 master instance, not 1 per image)
var instance = new Layzr()

// in the click handler that reveals the image
button.addEventListener('click', function() {
  // call layzr's update method manually
  instance.update()
})