我正在开发一个横向网站,可以让我的鼠标滚动滚动到左右两侧...
我的jQuery包含序列:
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript" src="js/jquery-1.11.1.js"></script>
<!--jquery validation script-->
<script type="text/javascript" src="http://ajax.aspnetcdn.com/ajax/jquery.validate/1.11.1/jquery.validate.min.js"></script>
<!--Smooth Scroll-->
<script type="text/javascript" src="js/jquery.easing.1.3.js"></script>
Run Code Online (Sandbox Code Playgroud)
我的代码如下:
<script type="text/javascript" src="js/jquery.mousewheel.min.js"></script>
<script>
$.noConflict();
$(function() {
$("body").mousewheel(function(event,delta) {
this.scrollLeft -= (delta * 30);
event.preventDefault();
})
})
$(function() {...});
$(document).ready(function() {
$('#form').validate({...});
$("#submit").click(function()
{...});
})
</script>
Run Code Online (Sandbox Code Playgroud)
我的"身体"CSS如下:
html {
width:100%;
overflow-y:hidden;
overflow-x: scroll;
}
body{
}
Run Code Online (Sandbox Code Playgroud)
目前我怀疑的代码是:
<!--Smooth Scroll-->
<script type="text/javascript" src="js/jquery.easing.1.3.js"></script>
Run Code Online (Sandbox Code Playgroud)
我认为这与鼠标滚动崩溃.
鼠标滚动工作,唯一的问题是鼠标滚动不顺畅,有时停在那里,有时甚至无法移动,不是我的鼠标问题.我不确定是什么原因造成这种情况,因为我已经尝试将它调试了2天.有人在这里分享他们对这个问题的看法吗?
我一直在寻找解决方案,但在我的案例中看起来很奇怪.滚动到某个部分并在中间卡住.(只是滚动条.)我在Mac上使用Chrome进行测试.顺便说一句,滚动时有任何类似AutoShift的解决方案,因为当我按下Shift键时,这对我有用.