-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.js
45 lines (39 loc) · 1.08 KB
/
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
const {body} = document
const logoEls = document.querySelectorAll('.brand-img .logo-title')
function changeLogoColor(ischanged) {
if (!ischanged) {
logoEls.forEach(logoEl => {
logoEl.setAttribute('fill', '#54575A')
});
} else {
logoEls.forEach(logoEl => {
logoEl.setAttribute('fill', 'whitesmoke')
});
}
}
function changeBackground(number) {
// Check if background already showing
if (body.classList.contains(`background-${number}`)) {
body.classList.remove(`background-${number}`)
changeLogoColor(false)
return
}
// Reset CSS Class for body
body.classList = ''
switch (number) {
case '1':
body.classList.add('background-1')
changeLogoColor(false)
break;
case '2':
body.classList.add('background-2')
changeLogoColor(true)
break;
case '3':
body.classList.add('background-3')
changeLogoColor(true)
break;
default:
break;
}
}