Override browsers CTRL+(WHEEL)SCROLL with javascript

前端 未结 3 721
情话喂你
情话喂你 2021-01-04 17:58

In most browsers on linux, CTRL+(WHEEL)SCROLL allows the user to zoom in and out of the page by enlarging or shrinking the size of all elements. Now I want to ove

3条回答
  •  伪装坚强ぢ
    2021-01-04 18:33

    https://developer.mozilla.org/en/Code_snippets/Miscellaneous#Detecting_mouse_wheel_events describes how to add a handler for mousewheel events in Firefox — including, theoretically, Ctrl+mousewheel events — but it mentions that if the user's preferences are such that a given modifier+mousewheel combination changes the text size, then these event-listeners will not be called. So, it doesn't seem to be possible (though I haven't tested myself to confirm the accuracy of that page).

    Other browsers may behave differently, of course. If you're O.K. with it not working in Firefox, you can try registering your handler by setting window.onmousewheel.

提交回复
热议问题