fredwu / jquery-endless-scroll

Endless/infinite scrolling/pagination.
http://fredwu.github.com/jquery-endless-scroll/
837 stars 176 forks source link

how to destroy/recreate endless scroll. #33

Open JackieManuja opened 11 years ago

JackieManuja commented 11 years ago

how we can destroy/recreate endless scroll at certain activity/condition in the page with resetting everything like fireSequence /pageSequence along with attributes.

alexsegura commented 11 years ago

EndlessScroll listens the scroll event and executes a function periodically, so you just need to remove the binding and clear the interval.

The constructor returns the pointer to the interval.

var interval;
// Destroy EndlessScroll
if (interval) {
    clearInterval(interval);
    $('#element').unbind('scroll');
}
interval = $('#element').endlessScroll();