How do I prevent scrolling with arrow keys but NOT the mouse?

后端 未结 3 1757
無奈伤痛
無奈伤痛 2020-12-05 00:12

Since I\'m using jQuery, any solution via that would work too. Ideally, I\'d like to know both, though.

I already have the arrow keys bound to another function on my

3条回答
  •  忘掉有多难
    2020-12-05 00:56

    If you add a document level keypress handler it will prevent normal scroll on the page at any time, not only when your element has the focus, this might be an undesired effect.

提交回复
热议问题