Created
February 19, 2017 15:55
-
-
Save wernersmit/08a11430add7604c497ba07a22898c8e to your computer and use it in GitHub Desktop.
Open next panel in jQuery accordion programatically
This file contains hidden or 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
/* | |
* Source: http://stackoverflow.com/questions/11041420/how-to-programmatically-open-jquery-accordion-content-panel | |
*/ | |
var $accordion = $("#accordion").accordion(); | |
function openNextAccordionPanel() { | |
var current = $accordion.accordion("option","active"), | |
maximum = $accordion.find("h3").length, | |
next = current+1 === maximum ? 0 : current+1; | |
// $accordion.accordion("activate",next); // pre jQuery UI 1.10 | |
$accordion.accordion("option","active",next); | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment