2010-09-16 5 views
0

вот код. то, что я хочу сначала #spider к easeOutBounce затем начать делать эту анимациюКак объединить эти два кода анимации 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

Смежные вопросы