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