我有一個簡單的Flash動畫,我試圖用jQuery重建。我有5個動畫被鏈接在一個接一個地開始。在所有動畫啓動後,我需要暫停5秒鐘,清除自身並再次開始動畫。我需要無限期地做到這一點。 這裏是我的代碼:jQuery功能內重複動畫
$(".bars").ready(function() {
$(".barone").animate({
'height': '49px'
}, 2000, function() {
$(".bartwo").animate({
'height': '112px'
}, 2000, function() {
$(".barthree").animate({
'height': '174px'
}, 2000, function() {
$(".barfour").animate({
'height': '236px'
}, 2000, function() {
$(".barfive").animate({
'height': '298px'
}, 2000, function() {
$('.bars div').delay(5000, function() {
$('.bars div').css({
"height": "0"
});
});
});
});
});
});
});
});
請原諒我的源格式,該文本字段沒有與我同意。
你也可以看到這個例子:http://execusite.com/fazio/files/careers-banner/test.html
任何幫助是極大的讚賞
這是否是正確的呢?
功能animateThis(){ $(」條格:第n個孩子(1) 「)。動畫({ '高度': '49px'},2000,函數(){ $(」 酒吧。 ('.bar div:nnth-child(3)「)。animate({'div':nnth-child(2)」)。animate({'height':'112px'},2000,function(){$ ('。bars div:nth-child(4)「)。animate({'height':'236px'},2000,function(){ $(「。bars div:nth-child(5)」)。animate({'height':'298px'},2000,function(){ $('。bars div')。delay(2000)。函數(){animateThis()}; }}; }};
}); }); } $(「。bars」)。ready(function(){animateThis()});
我爲我的無知道歉,我對jQuery有點新,但仍然試圖掌握語法。
當您正在編輯帖子時,您可以選擇一個區域,然後單擊小「1010」按鈕以「縮進4個空格」。 – 2010-12-02 00:28:53
非常感謝! – 2010-12-02 00:29:49