3

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

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

3 回答 3

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();
            }
        }
    });
});
于 2013-04-18T11:58:06.013 回答
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++;  
        }
    });
});
于 2014-06-11T06:53:56.090 回答
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();
            }
        }
    }
});
于 2013-11-06T06:06:25.830 回答