Difference between revisions of "Widget:Compass"
From LINKS Community Center
Line 704: | Line 704: | ||
</div> | </div> | ||
<script> | <script> | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
// Attach plus icon to the title of expandable blocks. | // Attach plus icon to the title of expandable blocks. | ||
document.querySelectorAll('.theme > h2, .subtheme > h3, .question > h4').forEach(el => { | document.querySelectorAll('.theme > h2, .subtheme > h3, .question > h4').forEach(el => { | ||
Line 729: | 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') { | ||
− | |||
event.target.classList.toggle('opened'); | event.target.classList.toggle('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 12:16, 7 December 2022
Development version of the Compass.
Not ready for production!