-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.js
30 lines (22 loc) · 955 Bytes
/
main.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
27
28
29
30
const hamburger = document.getElementById('hamburger');
const navUl = document.getElementById('nav-ul');
hamburger.addEventListener('click', () => {
navUl.classList.toggle('show');
});
function toggleDarkMode() {
let bodyElement = document.getElementById('main-background');
let darkModeButtonElement = document.getElementById('darkMode');
let navbarHeaderElement = document.getElementById('navbar');
//if in dark mode, change to light
if (bodyElement.style.background === "black") {
bodyElement.style.background = "rgb(255, 255, 254)";
bodyElement.style.color ="black";
darkModeButtonElement.innerText = "Dark Mode";
navbarHeaderElement.style.background = "white";
} else {
bodyElement.style.background ="black";
bodyElement.style.color ="white";
navbarHeaderElement.style.background = "black";
darkModeButtonElement.innerHTML = "Light Mode"
}
}