質問

ったほうがいいと思うよJqueryスライドショー.しているとのことです、サムネイルをクリックすると、を明らかに大きな画像としてのオーバーレイでふるい分けされ合わせの詳細は、大量の画像を私は追加の属性に各サムネイルと大きな画像です。の属性を含む多くの選手親指をそれに対応する大型イメージです。この作品がスライドショーが存在します。していきたいと思っていま仕事をする場合はスライドショーがあります。

このコードを追加属性を親指と大きな画像:

thumbNo = 0;
largeNo = 0;
$('.slideshow_content .thumbs img').each(function() {            
   thumbNo++;
   $(this).attr('thumbimage', thumbNo);
   $(this).attr("title", "Enter image gallery");
});
$('.slideshow_content .image_container .holder img').each(function() {   
   largeNo++;
   $(this).addClass('largeImage' + largeNo);
});

この作品。のincrementation働きがスライドショー、ページ上のだろうと思ったら、これを付けコードに各機能---

$('.slideshow').each(function() {
    thumbNo = 0;
    largeNo = 0;
    $(this + '.slideshow_content .thumbs img').each(function() {            
       thumbNo++;
       $(this).attr('thumbimage', thumbNo);
       $(this).attr("title", "Enter image gallery");
    });
    $(this + '.slideshow_content .image_container .holder img').each(function() {   
       largeNo++;
       $(this).addClass('largeImage' + largeNo);
    });
});

このincrimentingオペレーターはリセットのスライドショーの本部長.スライドショー)で終わる詳細に。スライドショー divている番号1,2,3等と親指のです。スライドショー divている番号4,5,6。くの、めんどくさいんだよなーの番号です。スライドショーの部リセット1から始ますか?

これは本当に難しい説明は簡潔に記入.私は誰かを取得します要旨.

役に立ちましたか?

解決

に、それぞれ下レベルにしてくださいscoped各スライドショーのようになります:

$('.slideshow_content').each(function() {
    thumbNo = 0;
    largeNo = 0;
    $(this).find('.thumbs img').each(function() {
       $(this).attr('thumbimage', thumbNo++);
       $(this).attr("title", "Enter image gallery");
    });
    $(this).find('.image_container .holder img').each(function() {   
       $(this).addClass('largeImage' + largeNo++);
    });
});

このセットに0が内蔵 .slideshow_content ブロック、ループ内での代わりに設定することで、全体的に、そしてループを通じてすべてのブロックとなります。

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top