[英]Is there a way for JS to detect that the bottom of a div has been reached, rather than the bottom of a page?
我现在正在使用这个:
$(window).scroll(function() {
if($(window).scrollTop() + $(window).height() == $(document).height()) {
$(".initial").delay(2000).fadeOut("slow", function() {
$(".secondary").fadeIn("slow");
});
}
});
而且我尝试摆弄window
并用div名称和静态像素值替换它,以至于无济于事。
是。 更换$(document).height()
由(
$(elem).offset().top
+
$(elem).outerHeight()
)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.