stop mousewheel's continued effect

断了今生、忘了曾经 提交于 2019-12-25 07:49:26

问题


How can I stop this effect:

I'm scrolling in a div using the mousewheel, and when I reach the bottom of the scroll content, then mousewheel continues the scrolling on the body (or on the first scrollable element, that wraps my div).


回答1:


This continuum scroll also bothers me on websites..

The theory would be something as:
The element you want to scroll, must have an JavaScript event listener of scroll attached to it, so when the scroll is at zero and the user scrolls up you OR the element is scrolled at maximum and the user scrolls down, then you return false

Usign jQuery, something like:

$(".scrollable").scroll(function(){
 // use something like if( $(this).scrollTop() .... ), then return false
});


来源:https://stackoverflow.com/questions/9159327/stop-mousewheels-continued-effect

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!