jQuery查找div是否到达滚动底部 [英] Jquery find if div reached the bottom on scroll
本文介绍了jQuery查找div是否到达滚动底部的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我无法正常工作,这是什么问题?
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.
推荐答案
http://jsfiddle.net /collabcoders/v2RbN/1/
$("span").hide();
$(".box").scroll(function() {
if($(this).scrollTop() + $(this).innerHeight() >= $(this)[0].scrollHeight) {
$("span").show();
} else {
$("span").hide();
}
})
这篇关于jQuery查找div是否到达滚动底部的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文