我用這個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