Flexslider,在最后一张幻灯片上/后禁用鼠标滚轮

时间:2014-06-29 08:11:45

标签: javascript jquery flexslider

我目前正在使用鼠标滚轮从幻灯片转到幻灯片。我的滑块是全屏的,所以你无法滚动传递它。这很好,但我想禁用flexslider的鼠标滚轮功能,以便在最后一张幻灯片上,它们可以自由滚动或者通过它,或者回到它上面。我目前有以下内容:

 $('#main_slider .flexslider').flexslider({
      animation: "fade",
      animationSpeed: 650,
      move: 1,
      controlNav: false,
      directionNav: false,
      mousewheel: false,  
      animationLoop: false,
      start: function(slider){
        $('body').removeClass('loading');
      },
      before: function(slider){

        //console.log(slider)

        //  Determine which slide we're moving to
          // slidingTo = slider.animatingTo;
          //console.log('sliding to: '+slidingTo);

          $('.flexslider .slides > li').removeClass('hovered');
      },
      after: function(slider){

        $('.flex-active-slide').addClass('hovered');
        //console.log('triggered mouse');
        if (slider.currentSlide == 1) { // TO SEE IF THE CURRENT SLIDE IS 2 TEST...
          $('.flex-active-slide.hovered').css('background','blue')
        }
        if (slider.currentSlide == 2) { // TO SEE IF THE CURRENT SLIDE IS 3 TEST...
          $('.flex-active-slide.hovered').css('background','red')
        }

      },
      end: function(){

        slider.pause();

        WHAT GOES HERE TO DISABLE THE FLEX SLIDER MOUSE-WHEEL FUNCTION??

      }
    });

2 个答案:

答案 0 :(得分:0)

这最终做了伎俩(进入最后的功能)

$('#main_slider .flexslider').unmousewheel();

答案 1 :(得分:0)

谢谢,我能够在水平滑块中关闭鼠标滚轮!!

   }
    // MOUSEWHEEL:
    if (vars.mousewheel) {
      slider.bind('**unmousewheel**', function(event, delta, deltaX, deltaY) {
        event.preventDefault();
        var target = (delta < 0) ? slider.getTarget('next') : slider.getTarget('prev');
        slider.flexAnimate(target, vars.pauseOnAction);
      });
    }

    // PAUSEPLAY
    if (vars.pausePlay) methods.pausePlay.setup();