jscrollpane块滚动父级 [英] jscrollpane block scrolling parent
问题描述
我可以制作jscrollpne,即使子滚动到达底部时,父窗格也不会滚动。现在,当子滚动到达底部时,父卷轴会发生滚动。我希望父级只在鼠标离开子滚动窗格时滚动。
Can i make jscrollpne such that parent pane doesnot scroll even when child scroll has reached its bottom. Now when child scrolling reaches bottom scrolling of parent occurs. I want parent to scroll only when mouse is out of child scrollpane.
推荐答案
您描述的行为是设计的。这是本机浏览器滚动条在具有overflow:auto的元素上的行为方式。我不建议改变它。但是,如果您希望Borgenk的答案是正确的,您可以使用以下代码:
The behaviour you describe is by design. This is how the native browser scrollbars behave on an element which has overflow: auto. I wouldn't recommend changing it. However, if you wish to then Borgenk's answer is correct, you can use this code:
$('.scroll-pane')
.jScrollPane()
.bind(
'mousewheel',
function(e)
{
e.preventDefault();
}
);
在此处查看示例(您可能需要缩小窗口,以便父级需要滚动) : http://jsfiddle.net/VYcDZ/51/
See an example here (you may need to shrink your window so the parent has any need to scroll): http://jsfiddle.net/VYcDZ/51/
这篇关于jscrollpane块滚动父级的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!