Reset / disable endless scrolling after an AJAX call

I use an infinite-ajax-scroll ( https://github.com/webcreate/infinite-ajax-scroll ) plugin with filtering. I have filters that work with infinite scrolling, but my problem is that whenever the scroll gets the end of the results for one filter, it will no longer scroll even after selecting another filter. Therefore, I need to reset the scroll of the infinate when the filter is selected, but I can not find anywhere in the documentation on how to reset this, and I am not very good at jQuery and therefore I can not figure it out.

I also have certain filters that do not need hidden scrolling, and also to disable them.

$('.filter a').click(function() {
    //reset scroll somehow
    //setTimeout("jQuery.ias({container: '#container'})",1000);
    var $this = $(this);
    var URL = $this.attr('href');
    loadMoreItems(URL, $this);
});
return false;
});

jQuery.ias({
    container: '#container', // main container where data goes to append
    item: '.element', // single items
    pagination: '.paginate', // page navigation
    next: '.paginate a', // next page selector
    loader: '<img src="public/img/ajax-loader.gif"/>', 
    noneleft: 'No more discounts for your selection', 
    triggerPageThreshold: '10', 
    trigger: "Load more items",
    history: false, 
    thresholdMargin: -350
});
+4
3

, ; , IAS.

,

1) hard- reset jQuery.ias({...})

2) . - ,

+4

janfoeh, , . init .

, .

$('.filter a').click(function() {
    $(window).unbind('scroll');
    initscroll();
});

function initscroll(){
    jQuery.ias({
        container: '#container', // main container where data goes to append
        item: '.element', // single items
        pagination: '.paginate', // page navigation
        next: '.paginate a', // next page selector
        loader: '<img src="public/img/ajax-loader.gif"/>', 
        noneleft: 'No more discounts for your selection', 
        triggerPageThreshold: '10', 
        trigger: "Load more items",
        history: false, 
       thresholdMargin: -350
    });
}
initscroll();

, initscroll .

+2

2 Ajax , . destroy() unbind() IAS . IAS.

$('.filter a').click(function() {
    setTimeout(function() { 
      ias.destroy(); 
    }, 1000);

    var $this = $(this);
    var URL = $this.attr('href');
    loadMoreItems(URL, $this);

    ias.bind();
});  

- , . http://infiniteajaxscroll.com/docs/methods.html

+2

All Articles