-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.js
46 lines (37 loc) · 1.03 KB
/
app.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
46
const listEl = document.querySelector('.faq__list');
for (let i = 1; i < listEl.children.length; i++) {
const boxEl = listEl.children[i].children[0];
const textEl = listEl.children[i].children[1];
let open = false;
boxEl.addEventListener('click', () => {
textEl.classList.toggle('hide');
if (open) {
boxEl.children[1].classList.toggle('rotate');
boxEl.children[0].style.fontWeight = '400';
open = false;
return;
}
boxEl.children[1].classList.toggle('rotate');
boxEl.children[0].style.fontWeight = '700';
open = true;
});
}
let desktop = false;
const boxImgEl = document.querySelector('.card__image--3');
window.addEventListener('resize', () => {
if (window.innerWidth > '1440') {
if (desktop) {
return;
}
console.log('desktop');
boxImgEl.classList.toggle('hide');
desktop = true;
} else if (window.innerWidth < '1440') {
if (!desktop) {
return;
}
console.log('mobile');
boxImgEl.classList.toggle('hide');
desktop = false;
}
});