-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
32 lines (27 loc) · 864 Bytes
/
index.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 questions = [];
for (let i = 1; i <= 5; i++) {
questions[i - 1] = document.querySelector(`label.label${i}`);
}
const answers = [];
for (let i = 1; i <= 5; i++) {
answers[i - 1] = document.getElementById(`answer${i}`);
}
const imagens = [];
for (let i = 1; i < 5; i++) {
imagens[i - 1] = document.getElementById(`img-plus${i}`)
}
const checkbox = [];
for (let i = 1; i < 5; i++) {
checkbox[i - 1] = document.getElementById(`plus${i}`)
}
imagens[0].src = 'assets/images/icon-minus.svg';
answers[0].style.height = '90px';
function mostrar(pergunta, check, source, height) {
if (checkbox[check].checked) {
imagens[pergunta].src = source;
answers[pergunta].style.height = height;
} else {
imagens[pergunta].src = 'assets/images/icon-plus.svg';
answers[pergunta].style.height = '0';
}
}