-
Notifications
You must be signed in to change notification settings - Fork 0
/
modal.js
40 lines (37 loc) ยท 1.35 KB
/
modal.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
31
32
33
34
35
36
37
38
39
40
//๋ชจ๋ฌ ์กฐ์
const modal = document.querySelector('.modal');
const closeBtn = document.getElementById('close_modal_btn');
setting.addEventListener('click', () => {
modal.classList.toggle('show');
});
modal.addEventListener('click', (event) => {
if (event.target === modal) {
modal.classList.toggle('show');
}
});
//๋ชจ๋ฌ ๋ซ๊ธฐ ๋ฒํผ
closeBtn.addEventListener('click', (event) => {
modal.classList.toggle('show');
})
//๋คํฌ๋ชจ๋
const body = document.querySelector('body');
const darkmode = document.getElementById('darkmode');
const container = document.getElementsByClassName('container')[0];
darkmode.addEventListener('change', () => {
if(darkmode.checked){ //๋คํฌ๋ชจ๋๋ก ์ ํ
body.style.backgroundColor = "#2a283f"; //๋ฐฐ๊ฒฝ์ ๋ณ๊ฒฝ
container.style.backgroundColor = "#2a283f";
body.style.color = 'white'; //css๊ฐ ์ ์ฉ๋์ง ์์ ๊ธฐ๋ณธ ํ
์คํธ ์์ ๋ณ๊ฒฝ
modal.style.color = "black";
if (document.querySelector('table')) {
document.querySelector('table').style.borderTopColor = "white";
}
} else { //๋ผ์ดํธ๋ชจ๋
body.style.backgroundColor = 'rgb(250, 250, 239)';
body.style.color = 'black';
container.style.backgroundColor = "rgb(250, 250, 239)";
if (document.querySelector('table')) {
document.querySelector('table').style.borderTopColor = "#444444";
}
}
});