[英]Why jQuery Nicescroll does not let parent DIV to scroll when the child DIV hits bottom?
我有一个名为“ Intro”的子DIV,在其上设置了Nicescroll:
$(document).ready(function({
$("#Intro").niceScroll({
cursorcolor:"#666",
cursoropacitymax:0.7,
cursorwidth:5,
cursorborder:"1px solid #2848BE",
cursorborderradius:"4px",
background:"#ccc",
autohidemode:"false"}).cursor.css({"background-mage":"url(img/mac6scroll.png)"});
一切正常,但是问题是,当使用Nicescroll滚动子DIV到达子DIV的底部时,父DIV不会开始滚动父DIV。
我知道Nicescroll有一个称为nativeparentscrolling
的选项,默认情况下设置为true。 但是,无论我是否在代码中包含此选项并将其显式设置为true还是不包含它,子DIV都会滚动到底部并在此处停止。 向上滚动时也是如此。 它在顶部停止,并且父DIV不会滚动父DIV。
当我在移动/平板电脑设备上时,也是如此。
有什么可以帮助我解决这个问题的,从而使Nicescroll更加出色吗?
这仅使用css对我有效,您可能需要调整滑轨的宽度以满足您的设计需求:
#your-element { //the element using nicescroll overflow-y: scroll !important; //brings back browser scroll functionality } #your-element::-webkit-scrollbar { display: none; //hides vertical scrollbar on webkit browsers } //cover up the other browsers vertical scrollbar .nicescroll-rails { background: #fff; } .nicescroll-rails:before { content: ''; position: absolute; height: (height of your element or 100%); width: 30px; top: 0; left: -20px; background-color: #fff; }
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.