我正在寻找我的问题的解决方案,但找不到。所以我下载了 jQuery 插件 (mCustomScrollbar) 并且没有一件事一切都很好 - 我无法在我的测试页面中通过鼠标滚轮滚动。控制台清晰,示例来自作者作品。我尝试在最新的 Firefox 和 Chrome 中运行我的代码,但代码不工作。
我的代码:
HTML:
<div id="elements">
<p>Elementy</p>
<div id="list">
xxx<br />xxx<br />
abc<br />def<br />ghi<br />jkl<br />abc<br />def<br />ghi<br />jkl<br />abc<br />def<br />ghi<br />jkl<br />abc<br />def<br />ghi<br />jkl<br />
</div>
</div>
JS:
$(document).ready(function(){
$('div#elements').mCustomScrollbar({
axis:'y',
theme:'dark',
mouseWheel:{
enable:true,
scrollAmount:5
}
});
});
CSS:
div#elements {
background-color:#fff;
border:1px solid #000;
height:350px;
position:absolute;
right:10%;
top:20%;
width:230px;
z-index:2;
}
div#elements p {
border-bottom:1px solid #000;
cursor:default;
margin:0;
padding:8px 0;
text-align:center;
}
如果有人可以帮助我,我会等待消息。
最佳答案
好的,我找到了解决方案。所以我必须使用 concat 版本的代码。
然后你将使用http://malihu.github.io/custom-scrollbar/jquery.mCustomScrollbar.concat.min.js , 但不是 http://malihu.github.io/custom-scrollbar/jquery.mCustomScrollbar.min.js .这很愚蠢,但很管用。
问候
关于javascript - 鼠标滚轮不工作(mCustomScrollbar jQuery 插件),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24148037/