スライドショーのカウンターを生成し、カウンターで画像と対応する番号の色を変更するはずのこのコードがあります。ただし、スライドショーが 2 回循環するdisplay:none
と、スライドショーがサイクルを開始するたびにカウンターが に変わり、再び表示されては消えます。
//icons for newsreel guide
for(i=0;i<document.getElementsByClassName("news").length;i++){
var count=i+1;
$('#counter').append('<span class="count">'+count+'</span>');
}
//newsreel script
$(".news").hide();
setTimeout (function() {
var wait = $(".news:last").index()*12000+12000;
function newsreel(){
var i=0;
(function showNews(elem){
if(i==document.getElementsByClassName("count").length){
i=0;
}
document.getElementsByClassName("count")[i].style.color="#000";
elem.fadeIn(2000,function(){
elem.delay(8000).fadeOut(2000,function(){
document.getElementsByClassName("count")[i].style.color="#3159a0";
i=i+1;
$(this).next().length && showNews($(this).next());
});
});
})
( $(".news:first"));
setTimeout (arguments.callee, wait);
}/*end newsreel()*/
newsreel();
}, 2000);
最初は廃止されたものを使用していると思っていましたが、arguments.callee
それを変更しましたが、それでもキューで発生します。何か案は?