2010-09-16 45 views
0

这里是目前为止的代码。我想是第一#spider到easeOutBounce然后开始做这个动画如何将这2个jQuery动画代码合并为一个

$("#spider").animate({top:"-=20px"},1000).animate({top:"+=20px"}, 1000); 

这里是所有的代码

$(document).ready(function() { 
    setTimeout("animation()",300); 
    }); 

    function animation(){ 
     spider(); 
    } 

    function spider(){ 
    $("#spider").animate({top: '200px' }, {queue:false, duration:600, easing:'easeOutBounce'}); 
     $("#spider").animate({top:"-=20px"},1000).animate({top:"+=20px"}, 1000); 
     setTimeout("spider()",2000); 
    } 

感谢

回答

0

你的意思??回调

function spider(){ 
    $("#spider").animate({top: '200px' }, 600, 'easeOutBounce', 
     function() { 
     $(this).animate({top:"-=20px"},1000).animate({top:"+=20px"}, 1000); 
    }); 
} 
+0

是的这就是我想要的谢谢你 – Jquery 2010-09-16 17:28:10

相关问题