如果我有一個函數,如下所示:打破一系列超時命令?
function x()
{
animate(a, 2000);
animate(b, 3000);
animate(c, 4000);
}
凡 - A,B &Ç - 是表示頁面上的元素的變量,和數量是傳遞到使用它作爲一個動畫()函數中的參數對於超時的持續時間值,就像這樣:
function animate(src, dur)
{
setTimeout(function() {
src.style.opacity = 1;
}, dur);
}
一切到目前爲止是好的,但如果我想打出來的動畫循環的能力,我怎麼做呢?將clearTimeout()是我正在尋找什麼?
我沒有看到動畫循環,我只看到三個獨立的超時。 – Bergi