next() 獲得匹配元素集合中每個元素緊鄰的同胞元素。
所以
function orderedPlace(ele, time){
ele.fadeIn(time, function() {
if(ele.next().length) {
orderedPlace(ele.next(), time)
} else {
goToCenter();
}
})
}
var cycles = $(".cycle");
orderedPlace(cycles.eq(0), 500);
這樣是沒法遍歷到cycle類下的所有元素的,除非他們都在同一個父元素下。
queue()
動畫有自己一個隊列,改變css不算作動畫,
所以
$("div").show().css("height", "50px")
是沒法實現先show再改變css的要這樣
$("div").show().queue(function() {
$(this).css("height", "50px");
})