user1483622
user1483622

Reputation: 1

LazyLoad Failure?

I have multiple div's with class="strip" and in each div there are many images in the lazyload style. (the class is set to overflow='hidden' so that the browser only see's a part of the images, these are the ones lazyload will load)

Then I call lazyload:

$(function(){
  $("img.lazy").lazyload({  
    container: $(".strip")
  });
});

It works perfectly on the first horizontal strip of images, in the next '.strip' classes after that it fails. It only runs on 1 class and quits as if I called an ID instead of a Class. Any ideas on what I did wrong?

Upvotes: 0

Views: 414

Answers (1)

Simon Hayter
Simon Hayter

Reputation: 3171

THe problem you have is that a div class is different to that of a div ID. You need to use # for ID's and . for Classes, see the code example below.

<script>
$(function(){
    $("img.lazy").lazyload({  
        container: $('.strip', '#strip')
    });
});
</script>

Upvotes: 1

Related Questions