Spaces:
Running
Running
Update index.html
Browse files- index.html +61 -18
index.html
CHANGED
|
@@ -1,19 +1,62 @@
|
|
| 1 |
-
<!
|
| 2 |
-
<html>
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
</html>
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
<html lang="en">
|
| 3 |
+
<head>
|
| 4 |
+
<meta charset="UTF-8">
|
| 5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
+
<title>5-Minute Timer</title>
|
| 7 |
+
<style>
|
| 8 |
+
body {
|
| 9 |
+
display: flex;
|
| 10 |
+
justify-content: center;
|
| 11 |
+
align-items: center;
|
| 12 |
+
height: 100vh;
|
| 13 |
+
background-color: #0a2472;
|
| 14 |
+
color: white;
|
| 15 |
+
font-family: 'Montserrat', sans-serif;
|
| 16 |
+
flex-direction: column;
|
| 17 |
+
}
|
| 18 |
+
h1 {
|
| 19 |
+
font-size: 4rem;
|
| 20 |
+
margin: 0;
|
| 21 |
+
}
|
| 22 |
+
button {
|
| 23 |
+
margin-top: 20px;
|
| 24 |
+
padding: 10px 20px;
|
| 25 |
+
border: none;
|
| 26 |
+
border-radius: 10px;
|
| 27 |
+
background-color: #ff7f50;
|
| 28 |
+
color: white;
|
| 29 |
+
font-size: 1.2rem;
|
| 30 |
+
cursor: pointer;
|
| 31 |
+
}
|
| 32 |
+
button:hover {
|
| 33 |
+
background-color: #ff9966;
|
| 34 |
+
}
|
| 35 |
+
</style>
|
| 36 |
+
</head>
|
| 37 |
+
<body>
|
| 38 |
+
<h1 id="timer">05:00</h1>
|
| 39 |
+
<button onclick="startTimer()">Start Timer</button>
|
| 40 |
+
|
| 41 |
+
<script>
|
| 42 |
+
let time = 300; // 5 minutes in seconds
|
| 43 |
+
let timerInterval;
|
| 44 |
+
|
| 45 |
+
function startTimer() {
|
| 46 |
+
clearInterval(timerInterval);
|
| 47 |
+
timerInterval = setInterval(() => {
|
| 48 |
+
const minutes = Math.floor(time / 60);
|
| 49 |
+
const seconds = time % 60;
|
| 50 |
+
document.getElementById('timer').textContent = `${minutes.toString().padStart(2, '0')}:${seconds.toString().padStart(2, '0')}`;
|
| 51 |
+
time--;
|
| 52 |
+
|
| 53 |
+
if (time < 0) {
|
| 54 |
+
clearInterval(timerInterval);
|
| 55 |
+
document.getElementById('timer').textContent = 'TIME\'S UP!';
|
| 56 |
+
}
|
| 57 |
+
}, 1000);
|
| 58 |
+
}
|
| 59 |
+
</script>
|
| 60 |
+
</body>
|
| 61 |
</html>
|
| 62 |
+
|