I am coding a page where the first time the user scrolls, it doesn\'t actually scroll the page down, instead it adds a class with a transition. I\'d like to detect when the
Try This using addEventListener.
addEventListener
window.addEventListener('mousewheel', function(e){ wDelta = e.wheelDelta < 0 ? 'down' : 'up'; console.log(wDelta); });
Demo
Update:
As mentioned in one of the answers, the mousewheel event is depreciated. You should use the wheel event instead.