Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9009561
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T02:13:48+00:00 2026-06-16T02:13:48+00:00

I’ve spent considerable amount of time trying to get isotope and lazy loading working

  • 0

I’ve spent considerable amount of time trying to get isotope and lazy loading working together.

The issue: lazy loading works if the user scrolls down, however if the user uses the filters, the items show up on top but the images will not load.

Here is someone with the same issue, but it seems he fixed it. I tried several things but still couldnt get it working.

Here is the dicussion https://github.com/tuupola/jquery_lazyload/issues/51

Thanks alot for your help

The code I am using is as follow.

jQuery(document).ready(function($) {
    $('#big_container .media_block img').each(function(index) {
        var item_height = $(this).attr("height");
        $(this).parent().parent().css("height",item_height);
    });
    $('#big_container').isotope({
    itemSelector : '.item',
    layoutMode : 'masonry',
    masonry: {
        columnWidth: 5,
    },
    sortBy : 'date',
    sortAscending : false,
    getSortData : {
        date : function ( $elem ) {
            return $elem.find('.date').text(); // Date format should be [Y-m-d H:i]
        },
        views : function( $elem ) {
            return parseInt( $elem.attr('data-views'), 10 );
          },
        //featured : function ( $elem ) {
        // return $elem.attr('data-featured');
        //  },
        rates : function( $elem ) {
            return parseInt( $elem.attr('data-rates'), 10 );
          },
        comments : function( $elem ) {
            return parseInt( $elem.attr('data-comments'), 10 );
          }
    }

    });

    $('#sort-by li a').click(function(){
        var $this = $(this);
        if ($(this).parent().hasClass('selected') ) {
          return false;
        }
        var $optionSet = $this.parents();
        $optionSet.find('.selected').removeClass('selected');
           $this.addClass('selected');
          var sortName = $(this).attr('href').slice(1);
          $('#big_container').isotope({ sortBy : sortName });
          return false;
    });
});
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T02:13:50+00:00Added an answer on June 16, 2026 at 2:13 am

    To get isotope’s sorting/filtering to work with lazyload you have to do the following.

    jQuery(document).ready(function($) {
        var $win = $(window),
            $con = $('#container'),
            $imgs = $("img.lazy");
    
        $con.isotope();
    
        $con.on('layoutComplete', function(){
            $win.trigger("scroll");
        });
    
        $imgs.lazyload({
            failure_limit: Math.max($imgs.length - 1, 0)
        });
    });
    

    Explanation

    According to the docs ( http://www.appelsiini.net/projects/lazyload )

    After scrolling page Lazy Load loops though unloaded images. In loop it checks if image has become visible. By default loop is stopped when first image below the fold (not visible) is found. This is based on following assumption. Order of images on page is same as order of images in HTML code. With some layouts assumption this might be wrong.

    With an isotope sorted/filtered list, the page order is certainly different from the HTML so we need to adjust our failure_limit.

    As you can see we store the jQuery object so that we can use its length-1 as our failure_limit. If you’re curious as to why it is length-1, it’s because of the following check in lazyload’s update method.

    if (++counter > settings.failure_limit) {
        return false;
    }
    

    Lazy load on other events

    If you are not triggering your lazyloads on scroll, you will need to swap the “scroll” trigger for whichever event you are using.

    Demo

    http://jsfiddle.net/arthurc/ZnEhn/

    Code for your site

    I stored some of the jQuery objects in variables as they need to be re-used.

    jQuery(document).ready(function($) {
        var $window = $(window);
        var $images = $('#big_container .media_block img');
        var $big_container = $('#big_container');
    
        $images.each(function(index) {
            var item_height = $(this).attr("height");
            $(this).parent().parent().css("height",item_height);
        });
    
    
        $big_container.isotope({
            itemSelector : '.item',
            layoutMode : 'masonry',
            masonry: {
                columnWidth: 5,
            },
            sortBy : 'date',
            sortAscending : false,
            getSortData : {
                date : function ( $elem ) {
                    return $elem.find('.date').text(); // Date format should be [Y-m-d H:i]
                },
                views : function( $elem ) {
                    return parseInt( $elem.attr('data-views'), 10 );
                  },
                //featured : function ( $elem ) {
                // return $elem.attr('data-featured');
                //  },
                rates : function( $elem ) {
                    return parseInt( $elem.attr('data-rates'), 10 );
                  },
                comments : function( $elem ) {
                    return parseInt( $elem.attr('data-comments'), 10 );
                  }
            }
    
        });
    
    
        $big_container.on('layoutComplete', function(){
            $win.trigger("scroll");
        });
    
        $('#sort-by li a').click(function(){
            var $this = $(this);
            if ($(this).parent().hasClass('selected') ) {
              return false;
            }
            var $optionSet = $this.parents();
            $optionSet.find('.selected').removeClass('selected');
               $this.addClass('selected');
              var sortName = $(this).attr('href').slice(1);
              $big_container.isotope({ sortBy : sortName });
              return false;
        });
    
    
        $images.lazyload({
            failure_limit : Math.max($images.length-1, 0);
        })
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I am trying to understand how to use SyndicationItem to display feed which is
I used javascript for loading a picture on my website depending on which small
I am trying to render a haml file in a javascript response like so:
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I'm trying to select an H1 element which is the second-child in its group
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I'm trying to use string.replace('’','') to replace the dreaded weird single-quote character: ’ (aka
I'm trying to create an if statement in PHP that prevents a single post

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.