I have following css
body{
height:100%;
width:100%;
overflow:hidden;
}
I am still able to detect scoll event using jquery.
$('body').on("mousewheel", function() {
alert($(this).scrollTop());
});
This gives 0 every time because of overflow:hidden
what i want is to detect the direction of scroll (up or down).
I cant use
var previousScroll = 0;
$(window).scroll(function(){
var currentScroll = $(this).scrollTop();
if (currentScroll > previousScroll){
alert('down');
} else {
alert('up');
}
previousScroll = currentScroll;
});
because scrollTop is always 0.
Is there a way?