cavis / gridheist

A jQuery plugin to hijack an image gallery, making it great.
MIT License
1 stars 0 forks source link

Feature: Add Lazy Loading #7

Open mcblum opened 10 years ago

mcblum commented 10 years ago

When using the jQuery lazyloading GH has a hard time working with the placeholder image. Unless I'm doing it wrong. Here's the code

var options = {
            thumbBorder:      10,
            thumbMinHeight:   10,
            thumbMinWidth:    100,
            thumbMaxHeight:   {{ Settings::getSetting('thumbnail_height') }},
            expander:         false
        };

        $('.gallery').gridHeist(options);
            $(".lazy").lazyload({
            event: "scrollstop",
            threshold: '200',
            load : function()
            {
              $('.gallery').gridHeist('update'); 
             }
       });

And the HTML:

<li>
<a href="http://app.nationalmachine.co/users/1/galleries/2/2/ElizabethAndJarett0045.JPG" data-uid="70">
<img class="lazy" data-original="http://app.nationalmachine.co/users/1/galleries/2/2/thumbs/ElizabethAndJarett0045.JPG" src="http://app.nationalmachine.co/images/placeholder.jpg" width="450" height="300">
</a>
</li>