forked from vidhvath28/Mirage-web
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.js
26 lines (23 loc) · 752 Bytes
/
script.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
function toggleDarkMode() {
document.body.classList.toggle("dark-mode");
if (document.body.classList.contains("dark-mode")) {
document.body.style.backgroundColor = "#333";
document.body.style.color = "#f0f0f0";
} else {
document.body.style.backgroundColor = "#f0f0f0";
document.body.style.color = "#333";
}
}
function openModal() {
document.getElementById("myModal").style.display = "flex";
}
function closeModal() {
document.getElementById("myModal").style.display = "none";
}
// Close the modal when clicking outside of the content
window.onclick = function (event) {
const modal = document.getElementById("myModal");
if (event.target == modal) {
closeModal();
}
};