Detecting mousewheel on the x-axis (left and right) with Javascript

后端 未结 5 1928
面向向阳花
面向向阳花 2020-12-13 10:43

I know it\'s possible to detect up and down e.g.

    function handle(delta) {
    if (delta < 0) {
        alert(\'down\');
} else {
    alert(\'up\');
           


        
5条回答
  •  無奈伤痛
    2020-12-13 11:10

    • The DOMMouseWheel event in Firefox has an axis property.

    • The mousewheel event in Chrome has wheelDeltaX and wheelDeltaY.

    • Sadly, I cannot find any equivalent propery for IE events (testing on IE9).

提交回复
热议问题