Get mouse wheel events in jQuery?

thejh picture thejh · Nov 18, 2011 · Viewed 277.7k times · Source

Is there a way to get the mouse wheel events (not talking about scroll events) in jQuery?

Answer

mahdi shahbazi picture mahdi shahbazi · Mar 26, 2013
​$(document).ready(function(){
    $('#foo').bind('mousewheel', function(e){
        if(e.originalEvent.wheelDelta /120 > 0) {
            console.log('scrolling up !');
        }
        else{
            console.log('scrolling down !');
        }
    });
});