也许我处理这个错误的 - 没有人知道从鼠标滚轮滚动停止页面的方法吗?这甚至可以被禁用?
-
我充满了小格的当鼠标滚轮滚动动画其中一个div容器。这不是一个带溢出的div:hidden,它没有滚动区域 - 它只是一个简单的jquery动画(动画可以很好地工作)。
不幸的是,尽管我尽了最大的努力,但当鼠标位于容器格内时,我无法停止滚动整个页面。
我使用Brandon Aaron的jQuery滚轮插件(这应该是解决我的问题,但不幸的是它不是)。
这里是我的javascript:
$('#containerDiv').mousewheel(function(event,delta,deltaX,deltaY){
/* all of this is supposed to stop the page from scrolling... but it doesnt*/
event.bubbles=false;
event.cancelBubble=true;
if(event.preventDefault) event.preventDefault();
if(event.stopPropagation) event.stopPropagation();
if(event.stopImmediatePropagation) event.stopImmediatePropagation();
$(document).blur();
$(this).focus();
/*this function just animates the divs inside the container divs*/
animateDivs(delta);
});
伊夫经历过这些问题已经:
Prevent scrolling of parent element?
stop mousewheel's continued effect
stop scrolling of webpage with jquery
和他们都不 帮助。
任何人都可以提供更好的解决方案来解决这个问题吗?
$ .mousewheel犯规滚动元素。它通过鼠标滚轮添加滚动元素。你的例子呢。 (MouseWhell滚动被禁用,滚动条滚动被启用)http://jsfiddle.net/A8tjk/ – kubedan 2012-07-13 08:56:21
这个[answer](http://stackoverflow.com/a/4770179/1107651)给我一个类似的问题为我工作 – 2012-07-12 20:24:05