mousewheel event is not triggering in firefox browser

后端 未结 6 1540
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-01 15:40

Please refer the below code.

$(this.element).on(\"mousewheel\", this.chartMouseWheel);

chartMouseWheel:function(e) {
        if(e.originalEvent.wheelDelta /         


        
6条回答
  •  猫巷女王i
    2020-12-01 16:12

    This is 2017 and the right answer is now:

    $(window).on('wheel', function(event){
    
        // deltaY obviously records vertical scroll, deltaX and deltaZ exist too
        if(event.originalEvent.deltaY < 0){
            // wheeled up
        }
        else {
            // wheeled down
        }
    });
    

    Works with current Firefox 51, Chrome 56, IE9+

    Note: The value of the deltas will depend on the browser and the user settings.

提交回复
热议问题