-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.js
25 lines (24 loc) · 820 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
const overlay = document.querySelector(".overlay");
const btn = document.querySelector(".mode-btn");
const h1 = document.querySelector("h1");
const lastP = document.querySelector(".container p:last-of-type");
const jobTitle = document.querySelector(".container p span");
btn.addEventListener("click", () => {
if (
!h1.classList.contains("active") &&
!lastP.classList.contains("active") &&
!jobTitle.classList.contains("active")
) {
h1.classList.add("active");
lastP.classList.add("active");
jobTitle.style.color = "#fff";
overlay.style.background = "#1a202c";
btn.innerHTML = "☀️";
} else {
h1.classList.remove("active");
lastP.classList.remove("active");
jobTitle.style.color = "#000";
overlay.style.background = "#e2e8f0";
btn.innerHTML = "🌙";
}
});