Jquery帮助,循环动画
我是一个jquerynoob,如何循环这个?如果可能的话,我能把它整理一下吗?这样它就可以用更少的代码工作了Jquery帮助,循环动画,jquery,loops,callback,jquery-animate,settimeout,Jquery,Loops,Callback,Jquery Animate,Settimeout,我是一个jquerynoob,如何循环这个?如果可能的话,我能把它整理一下吗?这样它就可以用更少的代码工作了 $(document).ready(function() { speech_animation(); }); function speech_animation(){ $( "#b-block_wrap" ).delay(1000).fadeIn(500).animate({ top: 0}, {duration: 500,}); $( "#p-block
$(document).ready(function() {
speech_animation();
});
function speech_animation(){
$( "#b-block_wrap" ).delay(1000).fadeIn(500).animate({ top: 0}, {duration: 500,});
$( "#p-block_wrap" ).delay(2000).fadeIn(500).animate({ top: 0,}, {duration: 500,});
$("#first_wrap").delay(5500).fadeOut(500);
$( "#g-block_wrap" ).delay(6000).fadeIn(500).animate({ top: 0}, {duration: 500,});
$( "#y-block_wrap" ).delay(7000).fadeIn(500).animate({ top: 0}, {duration: 500,});
$("#second_wrap").delay(10500).fadeOut(500);
}
您可以在最后一个函数调用中使用回调,以便在最后一个函数调用完成后,它将调用自己
$(document).ready(function() {
speech_animation();
});
function speech_animation(){
$( "#b-block_wrap" ).delay(1000).fadeIn(500).animate({ top: 0}, {duration: 500,});
$( "#p-block_wrap" ).delay(2000).fadeIn(500).animate({ top: 0,}, {duration: 500,});
$("#first_wrap").delay(5500).fadeOut(500);
$( "#g-block_wrap" ).delay(6000).fadeIn(500).animate({ top: 0}, {duration: 500,});
$( "#y-block_wrap" ).delay(7000).fadeIn(500).animate({ top: 0}, {duration: 500,});
$("#second_wrap").delay(10500).fadeOut(500, speech_animation);//callback here
}
我很震惊,这不起作用,在最后两个部门消失后,我一无所有。