Changed Timer
This commit is contained in:
parent
30c7e5e985
commit
1e25ab109a
21
js/timer.js
21
js/timer.js
@ -17,20 +17,19 @@ var x = setInterval(function() {
|
||||
var minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60));
|
||||
// var seconds = Math.floor((distance % (1000 * 60)) / 1000);
|
||||
|
||||
// Display the result in the element with id="timer"
|
||||
if (days != 0 && hours != 0) {
|
||||
document.getElementById("timer").innerHTML = days + "d " + hours + "h";
|
||||
}
|
||||
else if (hours != 0) {
|
||||
document.getElementById("timer").innerHTML = hours + "h";
|
||||
}
|
||||
else {
|
||||
document.getElementById("timer").innerHTML = minutes + "m";
|
||||
}
|
||||
|
||||
// If the count down is finished, write some text
|
||||
if (distance < 0) {
|
||||
clearInterval(x);
|
||||
document.getElementById("timer").innerHTML = "LIVE";
|
||||
}
|
||||
// Display the result in the element with id="timer"
|
||||
if (days != 0) {
|
||||
document.getElementById("timer").innerHTML = days + "d " + hours + "h";
|
||||
}
|
||||
else if (hours != 0) {
|
||||
document.getElementById("timer").innerHTML = hours + "h" + minutes + "m";
|
||||
}
|
||||
else {
|
||||
document.getElementById("timer").innerHTML = minutes + "m";
|
||||
}
|
||||
}, 1000);
|
Loading…
Reference in New Issue
Block a user