-
Notifications
You must be signed in to change notification settings - Fork 1
/
script.js
27 lines (22 loc) · 902 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
27
document.addEventListener("DOMContentLoaded", () => {
let toggleSwitch = document.querySelector(".switch");
let topBg = document.querySelector('.top-bg');
let body = document.querySelector('.body');
let card = document.querySelectorAll('.card');
let grayText = document.querySelectorAll('.gray-text');
toggleSwitch.addEventListener("change", () => {
body.classList.toggle('body-light');
topBg.classList.toggle('top-bg-light');
card.forEach(card => {
card.classList.toggle('card-light');
if(!card.classList.contains('dark')) {
card.classList.add('dark');
} else {
card.classList.remove('dark');
}
})
grayText.forEach(gText => {
gText.classList.toggle('gray-text-light')
})
});
});