Javascript 我希望我的页面只滚动一次,以便连续多次滚动。下面是我的代码?
我希望我的页面只滚动一次,以便连续多次滚动。下面是我的代码Javascript 我希望我的页面只滚动一次,以便连续多次滚动。下面是我的代码?,javascript,jquery,mousewheel,Javascript,Jquery,Mousewheel,我希望我的页面只滚动一次,以便连续多次滚动。下面是我的代码 当我说少了一个零件时: var w=1500;//this value is added by me, you should post the part that provides this variable's value. if(w > 1300) { $('.scroll-pane').bind('mousewheel DOMMouseScroll MozMousePixelScroll', function(ev
当我说少了一个零件时:
var w=1500;//this value is added by me, you should post the part that provides this variable's value.
if(w > 1300) {
$('.scroll-pane').bind('mousewheel DOMMouseScroll MozMousePixelScroll', function(event, delta) {
if(event.originalEvent.wheelDelta /120 > 0 ) {
val =this.scrollRight + (delta *433 * 2 );
jQuery(this).animate({
scrollRight: val
}, 500,'easeOutSine');
event.preventDefault();
$(this).text('scrolling up !');
}
else {
val = this.scrollLeft - (delta * 433 * 2 );
jQuery(this).stop().animate({
scrollLeft: val
}, 500,'easeOutSine');
event.preventDefault();
}
clearTimeout(scrollTimeout);
});
} //this was missing in the original
最后一行是代码正常时缺少的部分请提供一个工作示例,使用html,例如使用JSFIDLE。我使用mouseweel.js进行水平滚动这是我的完整代码@verdesrobert@user3513879Plase post html代码
var w=1500;//this value is added by me, you should post the part that provides this variable's value.
if(w > 1300) {
$('.scroll-pane').bind('mousewheel DOMMouseScroll MozMousePixelScroll', function(event, delta) {
if(event.originalEvent.wheelDelta /120 > 0 ) {
val =this.scrollRight + (delta *433 * 2 );
jQuery(this).animate({
scrollRight: val
}, 500,'easeOutSine');
event.preventDefault();
$(this).text('scrolling up !');
}
else {
val = this.scrollLeft - (delta * 433 * 2 );
jQuery(this).stop().animate({
scrollLeft: val
}, 500,'easeOutSine');
event.preventDefault();
}
clearTimeout(scrollTimeout);
});
} //this was missing in the original