man*_*uch 4 html jquery scroll
我想检测到我到达div的底部我的div是400px高度与溢出隐藏我不知道正常高度但超过400px
我正在使用此代码,但它不起作用?
if($("#article-txt").scrollTop() + $("#article-txt").height() == $("#article-txt")[0].scrollHeight) {
alert("bottom!");
}
Run Code Online (Sandbox Code Playgroud)
小智 5
$("#parentdiv").scroll(function(){
if($(this)[0].scrollHeight - $(this).scrollTop() === $(this).outerHeight()) {
alert(1);
};
});
Run Code Online (Sandbox Code Playgroud)
作品.您需要添加父div名称,而不是滚动Div本身.