Search code examples
javascriptjquerylazy-loadingtablesorter

jQuery.tablesorter with Lazy Load


I'm attempting to run tablesorter and lazy load together, but when I sort the table the images stop loading. I can't seem to figure this one out on the approach. Any help would be appreciated.

JS:

$(document).ready(function()
    {
        $("#table").tablesorter();
    }
);
$(function() {
    $("img.lazy").lazyload({
      effect : "fadeIn"
    });
});

Solution

  • Sorting table will generate new position for images, so you could execute lazy load after sorting end.

    Try this:

    $(document).ready(function(){
         $("#table").tablesorter();
         $("#table").bind("sortEnd",function(e, table) {
             $("img.lazy").lazyload({
                effect : "fadeIn"
             });
         });
    });