我试图让Flexslider完成一个完整的循环,然后一旦它回到第一张幻灯片就停止或​​暂停。 到目前为止,这是我的代码:

$(window).load(function(){
    $('.flexslider').flexslider({
        animation: "slide",
        animationLoop: true, 
        slideshowSpeed: 5000,
        pauseOnHover: true,
        start: function(slider){
            $('body').removeClass('loading');
        }   
    });
});

===============>>#1 票数:5

试试这个:

$(window).load(function(){
    $('.flexslider').flexslider({
        animation: "slide",
        animationLoop: true, 
        slideshowSpeed: 5000,
        pauseOnHover: true,
        start: function(slider){
            $('body').removeClass('loading');
        },
        after: function (slider) {
            if ((slider.currentSlide + 1) == slider.count) {
                 slider.pause();
            }
        }
    });
});

===============>>#2 票数:2

Try this, it worked for me

$(window).load(function(){
    var loopCount = 0; 
    $('.flexslider').flexslider({
        animation: "slide",
        animationLoop: true, 
        slideshowSpeed: 5000,
        pauseOnHover: true,
        start: function(slider){
            $('body').removeClass('loading');
        },
        after : function(slider){
           if(slider.currentSlide == 0 && loopCount == 1){
             slider.pause();
           }   
        },
        end : function(slider){
          loopCount++;  
        }
    });
});

===============>>#3 票数:0

在循环特定时间后,使用此选项在第一张幻灯片处暂停。 将var n值更改为循环所需的时间。

var n = 2; 
$('.flexslider').flexslider({
    animation: "slide",
    slideshowSpeed: 5000,
    start: function(slider) {
        $('body').removeClass('loading');
    },
    after: function(slider) {
        if (slider.currentSlide == 0) { // is last slide
            n--;
            if(n==0) {
                slider.pause();
            }
        }
    }
});

  ask by deweylee translate from so

未解决问题?本站智能推荐: