Created
February 24, 2025 17:47
-
-
Save karenpayneoregon/e9c3227b1c53197922ecdffa56de492a to your computer and use it in GitHub Desktop.
Provides JavaScript helper methods to expand and collapse all items in a Bootstrap 5.3 accordion
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
function expandAll() { | |
document.querySelectorAll('.accordion-collapse').forEach(item => { | |
let bsCollapse = new bootstrap.Collapse(item, { toggle: false }); | |
bsCollapse.show(); | |
}); | |
} | |
function collapseAll() { | |
document.querySelectorAll('.accordion-collapse').forEach(item => { | |
let bsCollapse = new bootstrap.Collapse(item, { toggle: false }); | |
bsCollapse.hide(); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment