Reputation: 41
i want to detect that i reach the bottom of a div my div is 400px height with overflow hidden i don't know the normal height but more than 400px
i'm using this code but it doesn't work any idea?
if($("#article-txt").scrollTop() + $("#article-txt").height() == $("#article-txt")[0].scrollHeight) {
alert("bottom!");
}
Upvotes: 4
Views: 10114
Reputation: 51
$("#parentdiv").scroll(function(){
if($(this)[0].scrollHeight - $(this).scrollTop() === $(this).outerHeight()) {
alert(1);
};
});
Works. You need to add the parent div name, not the scrolling Div itself.
Upvotes: 5