我已經嘗試了幾種不同的方式,除了正確的。setTimeout /暫停/等
試圖這樣:
setTimeout(function() {
$('.historyTextBoxes p')
.bind('showText', function(e) {
$(this).fadeIn(800, function(){
$(this).next().length && $(this).next().trigger("showText");
});
}).eq(0).trigger('showText');
}, 4000);
將等待4秒,然後淡入,一個每個段落之後另一個在0.800毫秒的速度。
我想要做的是在0.800毫秒淡入一個段落,然後等待4秒下一段落中消失之前
的基本設置:
$('.historyTextBoxes p')
.bind('showText', function(e) {
$(this).fadeIn(800, function(){
$(this).next().length && $(this).next().trigger("showText");
alert('pause here');
});
}).eq(0).trigger('showText');
作品但是我還沒有找到正確的語法來讓它停留在警報的位置。
我試圖拋出調用一個函數,但我並不需要運行,除了是因爲要等待什麼。
因此,在僞代碼中,我試圖定義是這樣的:
function wait() {
pause(for 4 seconds);
}
然後我可以調用該函數,而不是上面的警報。我的問題setTimeout
已'定義一個函數',但我在想什麼。
你的意思是這樣的? http://roxon.in/scripts/fademe_jquery_plugin/ –
非常整潔,但它似乎是週期性的。雖然好發現。 –