Widget: Compass: Difference between revisions
From LINKS Community Center
Eschmidt (talk | contribs) No edit summary |
Eschmidt (talk | contribs) No edit summary |
||
Line 746: | Line 746: | ||
const theme = event.target.closest('.theme'); | const theme = event.target.closest('.theme'); | ||
document.querySelectorAll('.subtheme').forEach( | document.querySelectorAll('.subtheme').forEach(el => { | ||
if (theme.contains( | if (theme.contains(el)) el.classList.toggle('opened'); | ||
else | else el.classList.remove('opened'); | ||
}); | }); | ||
} | } | ||
if (event.target.tagName === 'H3') { | if (event.target.tagName === 'H3') { | ||
event.target.classList.toggle('opened'); | document.querySelectorAll('H3').forEach(h3 => { | ||
event.target.closest('.subtheme').querySelectorAll('.question').forEach(el => el.classList.toggle('opened')); | if (h3 === event.target) h3.classList.toggle('opened'); | ||
else h3.classList.remove('opened'); | |||
}); | |||
const theme = event.target.closest('.subtheme'); | |||
document.querySelectorAll('.question').forEach(el => { | |||
if (theme.contains(el)) el.classList.toggle('opened'); | |||
else el.classList.remove('opened'); | |||
}); | |||
// event.target.classList.toggle('opened'); | |||
// event.target.closest('.subtheme').querySelectorAll('.question').forEach(el => el.classList.toggle('opened')); | |||
} | } | ||
if (event.target.tagName === 'H4') { | if (event.target.tagName === 'H4') { |
Revision as of 17:42, 7 December 2022
Development version of the Compass.
Not ready for production!