希望你能帮助,这段代码不工作。它正在选择下一张图像,但如果它位于最后一张图像上,并且没有“下一张图像”,那么我想选择“李”中的第一张图像。我已经添加了if条件:if(nextLi.value!=='')...但是这似乎不起作用。。首先('li)选择列表中的第一项不起作用
function nextImg(){
$('#background').find('img').animate({'opacity': 0}, 500, function(){
var nextLi = $('.sel').parent().parent().next('li').find('a');
if (nextLi.value !=='') {
var nextLiA = nextLi.attr('rel');
$('#background').find('img').attr({'src':nextLiA});
$('.sel').appendTo(nextLi);
} else {
var nextLi = $('.sel').parent().parent().first('li').find('a');
var nextLiA = nextLi.attr('rel');
$('#background').find('img').attr({'src':nextLiA});
$('.sel').appendTo(nextLi);
}
});
}
你能张贴你的HTML标记吗 – Curt 2012-03-06 11:56:46