GStubbenhagen GStubbenhagen - 1 year ago 98
jQuery Question

Collapse jQuery Accordion On Click

I have created an accordion using jQuery which collapses fine when the user clicks a 2nd option but I would also like to have the option to collapse the open pane by clicking again on the header, how should I do this?

Here's a fiddle showing how I've set it up so far:

EDIT: Replaced code examples w/ jsFiddle link

Answer Source
//Initialize a accordion with the collapsible option specified.
$( ".selector" ).accordion({ collapsible: true });
//Get or set the collapsible option, after init.
var collapsible = $( ".selector" ).accordion( "option", "collapsible" );
$( ".selector" ).accordion( "option", "collapsible", true );


find this demo:

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download