I want an event to load more content when a user is scrolling and reaches nearly the bottom of the page, say about 100px from the bottom, the problem is that the events get
I was having this same problem too. I came across this link and it really helped (and worked)!
Update: I looked at the code and I think that when you rebind, you are missing the function to rebind to.
jsFiddle
function loadMore()
{
console.log("More loaded");
$("body").append("");
$(window).bind('scroll', bindScroll);
}
function bindScroll(){
if($(window).scrollTop() + $(window).height() > $(document).height() - 100) {
$(window).unbind('scroll');
loadMore();
}
}
$(window).scroll(bindScroll);