Last active
April 4, 2024 22:04
-
-
Save lambdamusic/4734346 to your computer and use it in GitHub Desktop.
JavaScript: JQuery Accordion: retrieve active tab / open dynamically #js
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
// imagine the accordion is started like this: | |
$("#accordion").accordion({ header: 'h5', collapsible: true , active: false}); | |
// this gets you the index of open accordion [0.....n] | |
$("#accordion h5").index($("#accordion h5.ui-state-active")); | |
// let's save that index.. and use it to activate/deactivate the tab | |
n = $("#accordion h5").index($("#accordion h5.ui-state-active")); | |
$('#accordion').accordion('activate', n); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment