Is there a way for JS to detect that the bottom of a div has been reached, rather than the bottom of a page?
I'm using this at the moment:
$(window).scroll(func开发者_运维知识库tion() {
if($(window).scrollTop() + $(window).height() == $(document).height()) {
$(".initial").delay(2000).fadeOut("slow", function() {
$(".secondary").fadeIn("slow");
});
}
});
And I've tried fiddling around with window and replacing it with div names and static pixel values for the scroll to no avail.
Yes. Replace $(document).height() by ($(elem).offset().top+$(elem).outerHeight())
加载中,请稍侯......
精彩评论