I am trying to calculate their position of a dynamic scrollbar when scrolling a window. I can get the starting scroll position at boot using:
var scrollY = $(window).scrollTop();
But this does not update as the window scrolls, I need to reload every time to get the updated variable. What do I need to do to keep this value while scrolling? I tried something like:
$(document).scroll(function(e){ $('#status').html(e.scrollY); });
And then create a div with the id "status" to output the result, but I get nothing. Can anyone help with this?
Thank you, Chris
source share