这是一个奇怪的错误,但所有自定义滚动插件,如nicescroll,perfectscrollbar,甚至jScrollPane都有相同的问题,每当iframe嵌入要滚动的容器,iframe从不监听鼠标滚轮事件既不触摸滑动事件(滚动)在移动设备上),搜索到处寻找解决方案似乎人们已经在插件页面上提交了问题,但没有人意识到这是一个普遍的错误而不是插件本身的错误 .
这是bug reporduced,应该在firefox上运行 .
HTML:
<div id="demo">
<iframe width="100%" height="390" src="//www.youtube.com/embed/SyoA4LXQco4" frameborder="0" allowfullscreen></iframe>
<div style="height:800px;"></div>
</div>
CSS:
#demo
{
height:200px;
background-color:red;
overflow:hidden;
}
JS:
$(window).load(function(e) {
$("#demo").niceScroll({
cursorborder: "0px solid #000",
horizrailenabled:"false"
})
alert("run this page on firefox , then try to scroll page ")
})