我用这个jQuery代码,使我的推荐部分工作:通过我的pen我怎样才能让我的滑环不断
$(document).ready(function() {
var testimonialItem = $(".testimonial-wrapper .testimonial-item");
var lengthOfItem = testimonialItem.length;
var counter = 0;
testimonialItem.hide();
setTimeout(function(){
startIteration(counter);
}, 1000);
function startIteration(counter) {
testimonialItem.eq(counter).fadeIn('slow', function() {
if(counter<=lengthOfItem){
setTimeout(function(){
testimonialItem.fadeOut('slow',function(){
if (counter == lengthOfItem) {
counter = 0;
}
else{
counter++;
}
setTimeout(function(){
startIteration(counter);
}, 500);
});
}, 2000);
}
});
}
});
看,我意识到分钟后离开该链接后,当我回去,滑块消失。 有没有一种方法可以解决这个问题,以便滑块始终循环?
也希望如果你能帮助添加naigation子弹,这样每次推荐的变化,子弹也改变颜色,你可以在示例图像看到先进
谢谢
您可以替换'.then(function(){setTimeout(testimonials,500) })'for .then(testimonials)'如果你想要延迟下一次调用'testimonials'达到'500'毫秒 – guest271314
到目前为止,它似乎是有效的。 有没有一种方法可以让你的代码中的子弹导航?知道它不是主要问题,但是如果你能支持,也会很感激。 –
@WosleyAlarico _“有没有一种方法可以从你的代码中导航子弹?”_不确定你的意思。什么是“子弹”? – guest271314