A scroll event actually fires many times for each scroll action (in some browsers such as Firefox), so the best approach to handling scroll is the Wheel Event .
Note The wheel event is triggered only when the mouse wheel is used , the cursor keys and dragging the scroll bar do not trigger the event; however, the scroll event occurs when you drag the scroll bar using the cursor keys or the mouse wheel.
I recommend checking out this example: fooobar.com/questions/24939 / ... , which implements cross-browser processing for the scroll action.
This is a short fragment using the wheel (for modern browsers):
$("html").on("wheel", function (e) { var deltaY = e.originalEvent.deltaY; var scrollTop = $(this).scrollTop(); if (deltaY > 0) { console.log("scroll down"); } else { console.log("scroll up"); } });
source share