Created
May 4, 2022 15:59
-
-
Save ronnieoverby/dee7b3cee7693fde0a3a839ca99fd928 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
// loop over all "up-down" elements | |
for(let ud of document.querySelectorAll('span[id$=ud]')) | |
{ | |
// reflect that it is already expanded | |
ud.className = 'arrow-up'; | |
// derive the expandable element's id | |
let id = ud.id.substring(0, ud.id.length - 2); | |
// collapse everything | |
toggle(id); | |
// add click handler for toggling | |
ud.addEventListener('click', e => { | |
toggle(id); | |
}); | |
} | |
</script> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment