Widget: Compass: Difference between revisions
From LINKS Community Center
Eschmidt (talk | contribs) No edit summary |
Eschmidt (talk | contribs) No edit summary |
||
Line 740: | Line 740: | ||
document.getElementById('cmp-container').addEventListener('click', event => { | document.getElementById('cmp-container').addEventListener('click', event => { | ||
if (event.target.tagName === 'H2') { | if (event.target.tagName === 'H2') { | ||
event.target.classList.toggle('opened'); | document.querySelectorAll('H2').forEach(h2 => { | ||
event.target.closest('.theme').querySelectorAll('.subtheme').forEach( | if (h2 === event.target) h2.classList.toggle('opened'); | ||
else h2.classList.remove('opened'); | |||
}); | |||
const theme = event.target.closest('.theme'); | |||
document.querySelectorAll('.subtheme').forEach(sub => { | |||
if (theme.contains(sub)) sub.classList.toggle('opened'); | |||
else sub.classList.remove('opened'); | |||
}); | |||
} | } | ||
if (event.target.tagName === 'H3') { | if (event.target.tagName === 'H3') { |
Revision as of 17:40, 7 December 2022
Development version of the Compass.
Not ready for production!