需要使图像id实例化的数字
var number = $(this).attr('rel');
number = parseInt(number);
$('#carousel .slides li:nth-child(' + (number + 1) + ')').click();
$('#carousel').flexslider({我的意思是将number = parseInt(number);替换为图像的id
Text <article class="col img_prev2">
<img src="img/slideshow/slideshow2.jpg" alt="#img2" rel="1" class="thumb_main_page">
<h5>Text</h5>
</article>在上面,rel属性从0( rel="0“)开始,所以我需要将其设置为"0”。
发布于 2013-04-06 16:50:15
不知道要求什么,但这是什么?:
var count = 0;
$("img").each(function(){
//start 0, then 1, then 2..
$(this).attr("rel",count++);
});http://jsfiddle.net/jA8CW/
https://stackoverflow.com/questions/15848053
复制相似问题