Thursday, December 4, 2014

Implement Jquery infinite scroll plugin

Plugin Source: https://github.com/paulirish/infinite-scroll/

Automatic Scroll:
$('selector').infinitescroll(options);

 Manual Scroll:
$('#scroll-container').infinitescroll(options);
$('#scroll-container').infinitescroll('unbind');

$('.view_more').click(function() {
    $('#scroll-container').infinitescroll('retrieve');
    return false;
});

Note:
You may have to add the manual trigger behavior if you are working with masonry or isotope in order to make it work. Just include manual-trigger.js after infinitescroll and pass the behavior by passing behavior: 'twitter' when calling the plugin.