0
我編寫了這個js/jquery倒計時。如果時間差爲0,我的計時器在00:00凍結並保持1:30分鐘並變爲紅色字體,我該怎麼做? 例如:維持時間00:05,5秒後它是00:00(紅色字體),並保持1:30分鐘。Javascript/jquery倒計時在00:00凍結
var timer1;
function cdtd1() {
var sad1 = new Date();
var dolazak1 = new Date(sad1.getFullYear(),sad1.getMonth(),sad1.getDate(),13,01,00);
var timeDiff1 = dolazak1.getTime() - sad1.getTime();
if (timeDiff1 <= 0) {
clearInterval(timer1);
$("#Box1").remove();
}
if (timeDiff1 > 1500000) {
clearInterval(timer1);
$("#Box1").remove();
}
var sekunde1 = Math.floor(timeDiff1/1000);
var minute1 = Math.floor(sekunde1/60);
var sati1 = Math.floor(minute1/60);
var dani1 = Math.floor(sati1/24);
sati1 %= 24;
minute1 %= 60;
sekunde1 %= 60;
$("#dani1Box").html(dani1);
$("#sati1Box").html(sati1 + ':');
$("#minute1Box").html('7-Dubrava '+ minute1 + ':');
$("#sekunde1Box").html(sekunde1);
timer1 = setTimeout(cdtd1, 1000);
}
$(document).ready(function() {
cdtd1();
});
這是HTML:
所有的<div id="Box1">
<h1 style="font-family:Helvetica;color:#FFFFFF;font-size:5px;"> </h1>
<div id="minute1Box"></div>
<div id="sekunde1Box"></div>
</div>