Hi,
I want to determine the scroll of the users. I'm using jQuery.. And jquery have .scroll event.. But the .scroll event can't determine whether the user is scrolling the page downwards or upwards.
Hi,
I want to determine the scroll of the users. I'm using jQuery.. And jquery have .scroll event.. But the .scroll event can't determine whether the user is scrolling the page downwards or upwards.
You can start with a variable like this:
var position = $(window).scrollTop(); // should start at 0
And then have something that monitors whether the scrollTop is going up or down:
$(window).scroll(function() {
var scroll = $(window).scrollTop();
if(scroll > position) {
// scrolling downwards
} else {
// scrolling upwards
}
position = scroll;
});