0
我甚至不知道如何解释这个问题。下面的代码具有我想要的效果,但它是完全多余和丑陋的,我不确定如何使它更加优雅。我试过一段时间没有成功。也许是递归函数还是有更好的方法来做到这一点?jQuery Animate多个选择器
function next() {
$('#scroll_wrapper li:first-child').animate({
'top' : -elemHeight-offSet
}, {duration: 1000, queue: false, complete: nextDone});
$('#scroll_wrapper li:nth-child(2)').animate({
'top' : offSet
}, { duration: 1000, queue: false });
$('#scroll_wrapper li:nth-child(3)').animate({
'top' : offSet2
}, { duration: 1000, queue: false });
function nextDone() {
var d = $(this).detach();
d.appendTo('#scroll_wrapper ul').css({'top' : elemHeight+100});
}
}
http://codereview.stackexchange.com/ – j08691 2012-02-22 16:39:29