我正在尝试让Flexslider进行完整循环,然后在返回第一张幻灯片后停止或暂停。到目前为止,这是我的代码:
$(window).load(function(){
$('.flexslider').flexslider({
animation: "slide",
animationLoop: true,
slideshowSpeed: 5000,
pauseOnHover: true,
start: function(slider){
$('body').removeClass('loading');
}
});
});
答案 0 :(得分: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();
}
}
});
});
答案 1 :(得分: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++;
}
});
});
答案 2 :(得分: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();
}
}
}
});