I have made this infinitely scrolling script, but I can’t rebind the window scroll after I unbinded it. Here’s the script:
$(function(){
$(window).scroll(function(){
var mostOfTheWayDown = ($(document).height() - $(window).height()) * 2 / 3;
if ($(window).scrollTop() >= mostOfTheWayDown) {
$(window).unbind('scroll');
$.ajax({
url: 'loadmore',
data: {lastrank: lastrank},
dataType: 'json',
type: 'POST',
success: function(json){
//some work here
$(window).bind('scroll');
}
});
}
});
});
How can I rebind the window scroll after a successful ajax call?
1 Answer