Andreas Selenwall
Andreas Selenwall

Reputation: 5785

Expanding jQuery accordion

Lets say you have 5 "accordions" (i.e. 5 expandible/collapsible sections). Is it possible to preset one of these sections to be expanded when the page is loaded?

Upvotes: 3

Views: 1938

Answers (3)

rdp
rdp

Reputation: 2088

Needs collapsible: true.

Code examples Initialize a accordion with the active option specified.

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

Get or set the active option, after init. //getter

var active = $( ".selector" ).accordion( "option", "active" );

//setter

  $( ".selector" ).accordion( "option", "active", 2 );

I hope that helps. You may check out http://jqueryui.com/demos/accordion/

Upvotes: 4

Muhamad Bhaa Asfour
Muhamad Bhaa Asfour

Reputation: 1035

yes there is active property to determine the default expanded section

you can see it here active

Upvotes: 1

Rafay
Rafay

Reputation: 31033

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

if you don't specify an option explicitly it'll default to first child here is a demonstration maybe it'll help

Upvotes: 1

Related Questions