Atif
Atif

Reputation: 10880

jQuery UI Accordion (hiding all by default)

Hello I am using jQuery UI Accodions

By default, the first accordion is shown and other are hidden. I would like to hide all the accordions by default until the user clicks it.

How do I do that ?

Thank You

Upvotes: 4

Views: 8181

Answers (4)

Vishal
Vishal

Reputation: 288

To hide all the accordion's panel by default, you need to set the following 2 options:

  $("#accordion").accordion({
    active: false,
    collapsible: true
  });

The active option specifies which panel is currently open. By default its value is 0, i.e the first panel.

The collapsible option specifies whether all the sections can be closed at once. Allows collapsing the active section.

Upvotes: 0

asimshahiddIT
asimshahiddIT

Reputation: 330

This is the updated code to accomplish the appropriate.

$( ".selector" ).accordion({active: false , collapsible: true});

Upvotes: 7

user1491819
user1491819

Reputation: 1830

"Setting active to false will collapse all panels. This requires the collapsible option to be true." http://api.jqueryui.com/accordion/#option-active

Upvotes: 0

Henrik P. Hessel
Henrik P. Hessel

Reputation: 36627

This code should accomplish this

$( ".selector" ).accordion({ active: false });

Upvotes: 7

Related Questions