问题
I cant get this tot work, what is the problem?
$("#scrollingbox").scroll(function() { //detect page scroll
if($("#scrollingbox").scrollTop() + $("#scrollingbox").height() == $("#scrollingbox").height()) //user scrolled to bottom of the page?
{
//do something
}
}
what happens is i need to scroll up again for it to detect that it reached the bottom.
回答1:
http://jsfiddle.net/collabcoders/v2RbN/1/
$("span").hide();
$(".box").scroll(function() {
if($(this).scrollTop() + $(this).innerHeight() >= $(this)[0].scrollHeight) {
$("span").show();
} else {
$("span").hide();
}
})
来源:https://stackoverflow.com/questions/21212051/jquery-find-if-div-reached-the-bottom-on-scroll