0
我有這個腳本的問題 -jquery.Countdown - 改變背景顏色
var date = new Date(new Date().valueOf() + 60 * 1000);
$('#clock').countdown(date)
.on('update.countdown', function(event) {
var format = '%M:%S';
if(date < 30) {
$("#countcon").addClass('bg-teal-800');
}
$(this).html(event.strftime(format));
})
.on('finish.countdown', function(event) {
$(this).html('This offer has expired!')
$("#countcon").removeClass('bg-teal-800');
$("#countcon").addClass('bg-pink-800');
});
我想如果日期<30秒改變DIV的背景顏色(countcoun),但其沒有作品對。
末變化的背景色(青色粉紅色),它的工作確定..
我試過 - 如果(event.offset.seconds < 30),但沒有任何反應太..(本倒計時開始與TEAL背景顏色
首先對您的時間和幫助@ kevin-katze很感興趣。我按照你所說的插入代碼,但是警報給我帶來了從當前時間開始的秒數 - 而不是倒計時。倒計時開始於1:00 – DANIEL
我編輯了我的答案。知道if語句應該按預期工作。請檢查更多問題。 –
是的!非常簡單的解決方案!我嘗試了很多替代品,但沒有任何工作..很多! – DANIEL