-
Notifications
You must be signed in to change notification settings - Fork 0
/
scripts.js
24 lines (20 loc) · 891 Bytes
/
scripts.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
document.addEventListener('DOMContentLoaded', () => {
const licaos = document.querySelectorAll('.licao-item');
licaos.forEach((licao, index) => {
licao.querySelector('.licao-header').addEventListener('click', () => {
alternalicao(index + 1);
});
});
function alternalicao(licaonumero) {
const licaoItem = document.querySelector(`#licao-conteudo-${licaonumero}`).parentElement;
licaoItem.classList.toggle('ativa');
const conteudo = licaoItem.getAttribute('conteudo-dados');
const dadosconteudo = JSON.parse(conteudo);
const dynamicContent = document.getElementById('conteudo-dinamico');
dynamicContent.innerHTML = `
<h2>${dadosconteudo.titulo}</h2>
<h3>${dadosconteudo.subtitulo}</h3>
<p>${dadosconteudo.texto}</p>
`;
}
});