Detect scrolling attempts in overflow:hidden page?

前端 未结 2 1662
萌比男神i
萌比男神i 2021-01-18 08:18

I want to detect when the user is trying to scroll up or down on my page, but since I don\'t want to allow the actual scrolling I have set an overflow:hidden body. The code

2条回答
  •  孤城傲影
    2021-01-18 08:42

    Try using jQuery mousewheel https://github.com/brandonaaron/jquery-mousewheel. You can detect the mousewheel movement. The other option is to not set the overflow to hidden but instead catch the scroll attempt and scroll them yourself. There are also a bunch of libraries for JS scrolling, I like http://manos.malihu.gr/jquery-custom-content-scroller/.

提交回复
热议问题