как объединить эти 2 кода анимации jquery в один - PullRequest
0 голосов
/ 16 сентября 2010

вот код пока. то, что я хочу, это сначала #spider для easeOutBounce, а затем начать делать эту анимацию

  $("#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);
  }

спасибо

1 Ответ

0 голосов
/ 16 сентября 2010

Вы имеете в виду обратный вызов ??

function spider(){
   $("#spider").animate({top: '200px' }, 600, 'easeOutBounce',
       function() {
         $(this).animate({top:"-=20px"},1000).animate({top:"+=20px"}, 1000);
   });
}
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...