Javascript – Get mouse wheel events in jQuery

javascriptjquerymousewheel

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

Best Answer

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