-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.js
35 lines (25 loc) · 932 Bytes
/
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
const questionsContainers = document.querySelectorAll('.question-container');
questionsContainers.forEach(question => {
question.addEventListener('click', (e) => {
if (question.classList.contains('active')) {
question.classList.toggle('active');
} else {
questionsContainers.forEach(container => {
container.classList.remove('active');
})
question.classList.add('active');
}
})
question.addEventListener('mouseover', (e) => {
question.children[0].children[0].style.color = 'hsl(14, 88%, 65%)'
})
question.addEventListener('mouseout', (e) => {
question.children[0].children[0].style.color = 'black'
})
})
function hideAll(current) {
questionsContainers.forEach(question => {
const answer = question.children[1]
answer != current ? answer.classList.add('hide') : '';
})
}