停止鼠标滚轮的持续作用 [英] stop mousewheel's continued effect

查看:110
本文介绍了停止鼠标滚轮的持续作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何停止这种影响:

我正在使用鼠标滚轮滚动div,当我到达滚动内容的底部时,鼠标滚轮继续在正文(或包裹我的div的第一个可滚动元素)上滚动.

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).

推荐答案

这种连续滚动也使我在网站上感到困扰.

This continuum scroll also bothers me on websites..

理论将是这样的:
要滚动的元素,必须附加有滚动的JavaScript事件侦听器,因此,当滚动为零且用户向上滚动时,或者元素滚动至最大且用户向下滚动时,则您return false

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,类似:

Usign jQuery, something like:

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

这篇关于停止鼠标滚轮的持续作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆