私はjQueryがあまり得意ではなく、プロジェクトに取り組んでいて、jQueryに関する問題で立ち往生しています。スライダーがあり、その html 構造は次のようになります。
<a class="slides" href="http://pvhorses.net/jersey/about-us/"><img src="http://pvhorses.net/jersey/wp-content/uploads/2013/08/front-pic-slide.jpg" alt="" class="change"></a>
これはjQueryです:
jQuery(function(){
//init js styles
jQuery('body').addClass('hasJS');
// homepage cycles
jQuery('#feature_gallery .bigimg').wrapAll('<div class="bigimgs">').parents('#feature_gallery').append('<ul class="menu" id="feature_gallery_pager">').cycle({
fx:'fade',
easing: 'swing',
inDelay: 250,
drop: 40,
timeout: 5000,
pause: true,
slideExpr: '.bigimg',
before:onBefore,
pager: '#feature_gallery_pager',
pagerAnchorBuilder: function(idx, slide) {
var img = jQuery(".slides").children().eq(0).attr("src");
return '<li><a href="#"><img src="'+img+'" class="thumb"><span></span></a></li>';
}
});
今、スライドのクラスでアンカーリンク(a)から「src」属性を取得しようとしていますが、ほとんど取得していますが、問題は最初の要素しか取得していないことです。そのすべての子要素から属性「src」を取得したい。
どうすればそれを達成できますか?
私を助けて、できるだけ早く返信してください。
ありがとうございました、
ウスマン・アリ・クレシ