mirror of
https://github.com/LucasVbr/timer.git
synced 2026-05-13 17:22:04 +00:00
Edit color and add sound
Sound do not play because there is a security on Chrome. User need to interact with the page.
This commit is contained in:
+5
-1
@@ -1,5 +1,7 @@
|
||||
/* HTML contents */
|
||||
var body = document.body;
|
||||
var timerHTML = document.getElementById("timer");
|
||||
var ding = document.getElementById("ding");
|
||||
|
||||
/* GET url variable */
|
||||
const queryString = window.location.search;
|
||||
@@ -14,6 +16,8 @@ let localTimer = setInterval(() => {
|
||||
timer.decrement();
|
||||
if(timer.getTime() < 0) {
|
||||
clearInterval(localTimer);
|
||||
timerHTML.style.color = "red";
|
||||
body.style.backgroundColor = "red";
|
||||
timerHTML.style.color = "white";
|
||||
ding.play();
|
||||
}
|
||||
}, 1000);
|
||||
Reference in New Issue
Block a user