What's the difference between “onwheel” and “onscroll” events?

前端 未结 4 2036
不知归路
不知归路 2020-12-20 13:09

When I tried to change the default scroll bar property, I found that it\'s not convenient by rewriting callback function for scroll() or onscroll e

4条回答
  •  眼角桃花
    2020-12-20 13:47

    MDN about onwheel:

    Non-standard
    This feature is non-standard and is not on a standards track. Do not use it on production sites facing the Web: it will not work for every user. There may also be large incompatibilities between implementations and the behavior may change in the future.

    The onwheel event gets fired when the mouse wheel is scrolled. This physical action may or may not also result in scroll events.

    Basically, onscroll is what you need.

提交回复
热议问题