jquery-lazyload

jqueryLazy not triggering when images gets visibles via css changes


I have a bunch of images, say 100 images, in a web page, and only 10 are visible without scrolling the page. The first 90 images have a "myclass" class.

I manage all images with jquery lazy (http://jquery.eisbehr.de/lazy/), and it works perfecty if I scroll the window.

However, If I make $(".myclass").hide() before scrolling down, I see the last 10 images, which don't have the "myclass" class, bug jquery lazy doesn't "reveal" them.

Why?


Solution

  • Because lazyload triggers on scroll events.

    $(window).scroll() (which triggers the scroll event on the window) is enough to solve the issue.

    If the scrollable div is not the window object, use it instead of $(window).