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:
@@ -8,6 +8,7 @@
|
||||
</head>
|
||||
<body>
|
||||
<p id="timer"></p>
|
||||
<audio id="ding" src="./sounds/ding.mp3"></audio>
|
||||
<script src="./js/url.js"></script>
|
||||
<script src="./js/timer.js"></script>
|
||||
<script src="./js/main.js"></script>
|
||||
|
||||
+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);
|
||||
Binary file not shown.
Reference in New Issue
Block a user