2015-10-30 108 views
1

我有一个孩子DIV名为“介绍”,其上Nicescroll设置:为什么jQuery Nicescroll不允许父DIV在子DIV达到底部时滚动?

$(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更好吗?

+0

同样的问题在这里:) – bard

回答

0

这仅仅使用CSS工作对我来说,你可能需要调整您的轨道宽度,以满足您的设计需求:

#your-element { //the element using nicescroll 
 
overflow-y: scroll !important; //brings back browser scroll functionality 
 
} \t \t \t 
 
#your-element::-webkit-scrollbar { 
 
\t display: none; //hides vertical scrollbar on webkit browsers 
 
} 
 

 
//cover up the other browsers vertical scrollbar 
 
.nicescroll-rails { 
 
\t background: #fff; 
 
} 
 
.nicescroll-rails:before { 
 
    content: ''; 
 
\t position: absolute; 
 
\t height: (height of your element or 100%); 
 
\t width: 30px; 
 
\t top: 0; 
 
\t left: -20px; 
 
\t background-color: #fff; 
 
}