2012-04-10 22 views

回答

2

鏈的動畫:

$('.my_element').animate(...first destination...) 
       .animate(...second destination...) 
       .animate(...third destination...) 
       .animate(...fourth destination...) 

您還可以將目的地存儲在數組中,並循環播放。

var destinations = [ 
     {top:..., left:...}, 
     {top:..., left:...}, 
     {top:..., left:...}, 
     {top:..., left:...} 
    ], 
    element = $('.my_element'); 

$.each(destinations, function(i, v) { 
    element.animate(v) 
}); 

Here's your code重做了一下。

相關問題