I\'m looking for something to this effect:
$(window).scroll(function(event){
if (/* magic code*/ ){
// upscroll code
} else {
// downscrol
Why nobody use the event
object returned by jQuery
on scroll ?
$window.on('scroll', function (event) {
console.group('Scroll');
console.info('Scroll event:', event);
console.info('Position:', this.pageYOffset);
console.info('Direction:', event.originalEvent.dir); // Here is the direction
console.groupEnd();
});
I'm using chromium
and I didn't checked on other browsers if they have the dir
property.