Skip to content

Commit

Permalink
modes enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
taneeshaa15 committed Jun 25, 2024
1 parent 468c468 commit 5ab0f0c
Show file tree
Hide file tree
Showing 3 changed files with 71 additions and 17 deletions.
9 changes: 6 additions & 3 deletions 404.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
<link rel="icon" href="assets/images/favicon/favicon.ico" type="image/x-icon" />
<link rel="stylesheet" href="./css/404.css">
<title>Error - 404</title>
<script src="./js/404.js" defer></script>
</head>

<body>
Expand All @@ -18,9 +19,11 @@
unavailable.</div>
<div class="text4 text3">Redirecting in <strong></strong> seconds</div>
<div class="text5"><a href="../index.html">Go to HomePage</a></div>

<div class="dark-mode-toggle">
<input type="checkbox" id="dark-mode-toggle">
<label for="dark-mode-toggle">Dark Mode</label>
</div>
</div>
<script src="./js/404.js"></script>
</body>

</html>
</html>
50 changes: 49 additions & 1 deletion css/404.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/* General styles */

* {
margin: 0;
padding: 0;
Expand Down Expand Up @@ -115,6 +117,8 @@ a:hover {
align-items: center;
}

/* Media queries for responsiveness */

@media only screen and (max-width: 705px) {
.text1 {
font-size: 175px;
Expand Down Expand Up @@ -186,4 +190,48 @@ a:hover {
transform: translateY(0);
opacity: 1;
}
}
}

/* Dark Mode Toggle */

.dark-mode-toggle {
position: fixed;
top: 20px;
right: 20px;
z-index: 100;
display: flex;
align-items: center;
justify-content: flex-end;
color: white;
}

.dark-mode-toggle label {
margin-left: 5px;
cursor: pointer;
}

.dark-mode-toggle input[type="checkbox"] {
display: none;
}

.dark-mode-toggle input[type="checkbox"] + label:before {
content: '\1F31E'; /* Sun emoji for light mode */
font-size: 20px;
}

.dark-mode-toggle input[type="checkbox"]:checked + label:before {
content: '\1F30C'; /* Moon emoji for dark mode */
}

body.dark-mode {
background: #333; /* Dark background color */
color: white;
}

body.dark-mode .container {
color: white; /* Adjust text color for dark mode */
}

body.dark-mode .star {
background: rgba(255, 255, 255, 0.8); /* Adjust star color for dark mode */
}
29 changes: 16 additions & 13 deletions js/404.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,3 @@
let n = 10 // seconds

setTimeout(function () {
window.location.href = './index.html';
}, n*1000);

document.querySelector('.text4').getElementsByTagName("strong")[0].innerHTML = n;
setInterval(() => {
document.querySelector('.text4').getElementsByTagName("strong")[0].innerHTML = n - 1;
n = n - 1
}, 1000);

// Generate stars
document.addEventListener('DOMContentLoaded', function () {
const starsContainer = document.querySelector('.stars');
for (let i = 0; i < 100; i++) {
Expand All @@ -21,4 +8,20 @@ document.addEventListener('DOMContentLoaded', function () {
star.style.animationDelay = `${Math.random() * 2}s`;
starsContainer.appendChild(star);
}

const darkModeToggle = document.getElementById('dark-mode-toggle');
darkModeToggle.addEventListener('change', function () {
document.body.classList.toggle('dark-mode');
});

let n = 10; // seconds
setTimeout(function () {
window.location.href = '../index.html';
}, n * 1000);

const countdownElement = document.querySelector('.text4').getElementsByTagName('strong')[0];
countdownElement.innerHTML = n;
setInterval(() => {
countdownElement.innerHTML = --n;
}, 1000);
});

0 comments on commit 5ab0f0c

Please sign in to comment.