How do I conditionally handle when an accordion section is open. What I am asking is this (in pseudo code):
if (this-accordion-section-open){
do something
Although the Accordion control is a jquery UI component you don't have to use jquery to verify the control is in its expanded state. A simple check like this will do:
/**
* returns true if the elt is a header tag of an accordion control
* that is in the active state (expanded)
* @param {HTMLElement} elt - one of the header elements of the accordion div
*/
function isActive(elt){
elt.classList.contains('ui-state-active');
}
if you WANT to use jquery you can do this:
$('query-string').hasClass('ui-state-active');