I have a div at the bottom of the screen at a fixed position with an arrow inside. How can I hide a div when the user scrolls to the bottom of the page?
$(window).scroll(function() { if($(window).scrollTop() + $(window).height() == $(document).height()) { $('div').hide(); } });
Try the following:
var vericalscroll= document.height - (window.pageYOffset + window.innerHeight);
if yours vericalscroll is 0, it means you rewrote at the end of the vertical scroll.
vericalscroll
You can try jQuery for this:
var max_scroll = 500; $(document).scroll(function(){ if($(this).scrollTop() >= max_scroll) { $('#my_div').fadeOut(); } });
where my_div is your div name and max_scroll is the scrolled position.
my_div
max_scroll