我希望我的页面只滚动一次以进行连续的多个滚动。下面是我的代码?

时间:2014-04-09 07:21:34

标签: javascript jquery mousewheel

  

我希望我的页面只滚动一次以进行连续的多个滚动。下面是我的代码?

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);
    });

1 个答案:

答案 0 :(得分:0)

当我说有一部分缺失时:

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

最后一行是代码缺失的那一行