I’m using this at the moment:
$(window).scroll(function() {
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())