function anim() {
clearTimeout(animTimeout);
$('#wrap .bullet').removeClass('active');
imageindex++;
$('#wrap .bullet:nth-child('+ imageindex +')').addClass('active');
$('#wrap .images img').fadeOut();
$('#wrap .images img:nth-child('+ imageindex +')').fadeIn();
if($('#wrap .images img').length == imageindex) {
imageindex = 0;
}
animTimeout = setTimeout(anim, 1500);
}
これが関数です。写真を変更したり、フェードインしたりフェードアウトしたりできます。これはスライドショーです。.bullet は、クリックすると特定の画像にジャンプできる単なる円です。
ちなみに、この関数は機能します。選択した画像にジャンプできます。
$('#wrap .bullets a').click(function(e){
e.preventDefault();
$('#wrap .images img').stop().attr('style', '');
imageindex = parseInt($(this).data('i') );
anim();
});
ただし、現在の写真の箇条書きをアクティブにして、前の写真にジャンプしたりしないようにしたいなど...
anim() 関数が私に与える効果は、最初のスライドですべての「.bullet」-s がアクティブなクラスを取得し、2 番目のスライドからは最初のスライドに戻るまでクラスを持たないことです。また。どうしてこれなの?imageindex が増加している場合、このような動作を行う理由がわかりません... 助けていただければ幸いです。