Collapse JQuery Accordion On Click

I created an accordion using jQuery that smoothes out when the user clicks the second option, but I would also like to be able to minimize the open panel by clicking on the title again, how do I do this?

Here is a fiddle showing how I installed it: http://jsfiddle.net/gstubbenhagen/JyFRC/

EDIT: Replaced w / js code examples

+4
source share
2 answers
//Initialize a accordion with the collapsible option specified. $( ".selector" ).accordion({ collapsible: true }); //Get or set the collapsible option, after init. //getter var collapsible = $( ".selector" ).accordion( "option", "collapsible" ); //setter $( ".selector" ).accordion( "option", "collapsible", true ); 

Source: http://jqueryui.com/demos/accordion/#option-collapsible

find this demo: http://jsfiddle.net/2DaR6/

+8
source

Did you mean the effect, like in this demo ?

Click on the selected tab to switch its contents closed / open. To enable this functionality, set the resettable option to true .

 collapsible: true 
0
source

Source: https://habr.com/ru/post/1396179/


All Articles