2

我有一个名为“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 变得更好吗?

4

1 回答 1

0

这对我只使用 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;
}

于 2017-02-28T17:10:31.090 回答