-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
26 lines (23 loc) · 870 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
function criaCartao(categoria, pergunta, resposta) {
let container = document.getElementById('container')
let cartao = document.createElement('article')
cartao.className = 'cartao'
cartao.innerHTML = `
<div class="cartao__conteudo">
<h3>${categoria}</h3>
<div class="cartao__conteudo__pergunta">
<p>${pergunta}</p>
</div>
<div class="cartao__conteudo__resposta">
<p>${resposta}</p>
</div>
</div>
`
let respostaEstaVisivel = false
function viraCartao() {
respostaEstaVisivel = !respostaEstaVisivel
cartao.classList.toggle('active', respostaEstaVisivel)
}
cartao.addEventListener('click', viraCartao)
container.appendChild(cartao)
}