disable scrolling on input focus in javascript

后端 未结 3 2153
心在旅途
心在旅途 2020-12-21 05:22

I was wondering if it was possible to stop the page from scrolling using javascript when a user type or clicks on a

3条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-21 06:01

    You could possibly set the scrollTop property to x every n milliseconds. The problem with that approach I would think would be that the page would look jerky (technical term) when the user attempted to scroll the page.

    Besides, you'd be breaking the expectations of the user that they be able to scroll the page at any time which I would recommend against as it could confuse them at best and annoy them at worst.

提交回复
热议问题