我在頁面上有三個圖像滑塊的實例,它們應該逐個淡入一個接一個。我正在使用innerfade.js推遲一個jQuery函數
我想讓他們在不同的時間開始,例如,第一個在2秒後開始,第二個在4秒後,第三個在6秒後。所以,fisrt轉換需要在2秒後發生,但是直到下一個衰落才需要6秒。
編輯: 他們應該在同一時間一起出現在頁面加載時,然後褪色一個接一個。
我不知道我是否可以做到這一點。我嘗試過使用setTimeout以及.delay,但我無法使它工作。原因可能是我對Javascript不太好。但我會很感激這裏的一些幫助。
這是我來自:
$(document).ready(
function(){
$('#header-img-1').innerfade2({
animationtype: 'fade',
speed: 750,
timeout: 6000,
type: 'random_start',
containerheight: '1em'
});
$('#header-img-2').innerfade2({
animationtype: 'fade',
speed: 750,
timeout: 6000,
type: 'random_start',
containerheight: '1em'
});
$('#header-img-3').innerfade2({
animationtype: 'fade',
speed: 750,
timeout: 6000,
type: 'random_start',
containerheight: '1em'
});
}
);
非常感謝。
'setTimeout'應該可以正常工作。你嘗試了什麼? – j08691
你可以嘗試http://benalman.com/projects/jquery-throttle-debounce-plugin/ – HungryCoder
你的問題可能來自你的函數'innerfade2'。你能提供代碼嗎? – sdespont