0

私はcycle.js小さなスライドショーに使用しています:

var $slider = $(".trauringe");
$slider.cycle({
timeout: 6000,
next:   '#next', 
prev:   '#prev',
before: beforePic,
after: afterPic });

および html マークアップ:

 <ul class="trauringe" style="width: 690px; height: 395px;">
   <img src="trauringe/1_Trauringe.jpg" style="display: none;" alt="Trauringe 1" />
   <img src="trauringe/2_Trauringe.jpg" style="display: none;" alt="Trauringe 2" />
   <img src="trauringe/3_Trauringe.jpg" style="display: none;" alt="Trauringe 3" />
   <img src="trauringe/4_Trauringe.jpg" style="display: none;" alt="Trauringe 4" />
   <img src="trauringe/5_Trauringe.jpg" style="display: none;" alt="Trauringe 5" />
 </ul>

altそして、次のように現在の画像を読み取る方法を理解しようとしています:

function afterPic() { 
      console.log($('.trauringe').find('img').attr('alt'));
        });

残念ながら、これは機能せず、現在ではなく最初のもののみが表示されます。

どんな助けでも大歓迎です!ありがとう

4

1 に答える 1