如何将这两个jquery动画代码组合成一个

如何将这两个jquery动画代码组合成一个,jquery,animation,Jquery,Animation,这是到目前为止的代码。我想要的是先让蜘蛛放松弹跳,然后开始做这个动画 $("#spider").animate({top:"-=20px"},1000).animate({top:"+=20px"}, 1000); 这是所有的密码 $(document).ready(function() { setTimeout("animation()",300); }); function animation(){ spider(); } functi

这是到目前为止的代码。我想要的是先让蜘蛛放松弹跳,然后开始做这个动画

  $("#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);
  }
谢谢你是说回电话吗

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