每当我的鼠标进入jScrollPane,我使用我的鼠标滚轮时,我希望浏览器本身的滚动条滚动而不是jScrollPane上的滚动条。jScrollPane如何删除鼠标滚轮功能
所以当我用我的鼠标滚轮在浏览器中向下滚动时,我用鼠标通过jScrollPane,它不应该停止在浏览器中向下滚动。
为什么?我在我的jScrollPane中使用了一个水平滚动条,我只想要我的鼠标滚轮仅用于垂直滚动。
希望这是有道理的,而不是模糊。
每当我的鼠标进入jScrollPane,我使用我的鼠标滚轮时,我希望浏览器本身的滚动条滚动而不是jScrollPane上的滚动条。jScrollPane如何删除鼠标滚轮功能
所以当我用我的鼠标滚轮在浏览器中向下滚动时,我用鼠标通过jScrollPane,它不应该停止在浏览器中向下滚动。
为什么?我在我的jScrollPane中使用了一个水平滚动条,我只想要我的鼠标滚轮仅用于垂直滚动。
希望这是有道理的,而不是模糊。
MHH ..它似乎并不JScrollPane中做出自己的启用/禁用鼠标滚轮,但你可以找到2个解决方案,我认为:
不包括jQuery的鼠标滚轮插件(即是可选的JScrollPane的)
取消绑定与jQuery容器的 “滚轮” 事件,它们使用了 $(**yourcontainer**).jScrollPane();
那样AFTER:
$(**yourcontainer**).unbind('mousewheel');
编辑:
这里是结合鼠标滚轮事件撑着代码:
$container.bind(
'mousewheel',
function (event, delta) {
delta = delta || (event.wheelDelta ? event.wheelDelta/120 : (event.detail) ? -event.detail/3 : 0);
initDrag();
ceaseAnimation();
var d = dragPosition;
positionDrag(dragPosition - delta * mouseWheelMultiplier);
var dragOccured = d != dragPosition;
return !dragOccured;
}
);
而且这里的插件,它的配置的描述:
* @name jScrollPane
* @type jQuery
* @param Object settings hash with options, described below.
* scrollbarWidth - The width of the generated scrollbar in pixels
* scrollbarMargin - The amount of space to leave on the side of the scrollbar in pixels
* wheelSpeed - The speed the pane will scroll in response to the mouse wheel in pixels
* showArrows - Whether to display arrows for the user to scroll with
* arrowSize - The height of the arrow buttons if showArrows=true
* animateTo - Whether to animate when calling scrollTo and scrollBy
* dragMinHeight - The minimum height to allow the drag bar to be
* dragMaxHeight - The maximum height to allow the drag bar to be
* animateInterval - The interval in milliseconds to update an animating scrollPane (default 100)
* animateStep - The amount to divide the remaining scroll distance by when animating (default 3)
* maintainPosition- Whether you want the contents of the scroll pane to maintain it's position when you re-initialise it - so it doesn't scroll as you add more content (default true)
* tabIndex - The tabindex for this jScrollPane to control when it is tabbed to when navigating via keyboard (default 0)
* enableKeyboardNavigation - Whether to allow keyboard scrolling of this jScrollPane when it is focused (default true)
* animateToInternalLinks - Whether the move to an internal link (e.g. when it's focused by tabbing or by a hash change in the URL) should be animated or instant (default false)
* scrollbarOnLeft - Display the scrollbar on the left side? (needs stylesheet changes, see examples.html)
* reinitialiseOnImageLoad - Whether the jScrollPane should automatically re-initialise itself when any contained images are loaded (default false)
* topCapHeight - The height of the "cap" area between the top of the jScrollPane and the top of the track/ buttons
* bottomCapHeight - The height of the "cap" area between the bottom of the jScrollPane and the bottom of the track/ buttons
* observeHash - Whether jScrollPane should attempt to automagically scroll to the correct place when an anchor inside the scrollpane is linked to (default true)
* @return jQuery
感谢您的快速反应,但两个选项都没有为我工作。 – user1081577 2012-07-05 11:30:59
Mhh ..我真的认为它会工作。也许尝试在初始化插件时将“wheelSpeed”设置为0,但我认为它不适合。 – Ricola3D 2012-07-05 16:00:01
只有当我包含jquery.mousewheel插件时,它才适用于我。 – user1081577 2012-08-20 13:29:16
见本链接,有可能重复:http://stackoverflow.com/questions/1803375/how-to-disable-scrolling-from-mouse-wheel-in-a-jscrollpane-header – 2012-07-05 10:29:59
@AhsanRathod:看起来有2个jScrollPane:一个在Java中,另一个在jQuery/JS中。你给的链接被标记的“Java”,这一个“的Javascript” ^^ – Ricola3D 2012-07-05 15:47:29