Expanding jQuery accordion
Lets say you have 5 "accordions" (i.e. 5 expandible/collapsible sections). Is it pos开发者_高级运维sible to preset one of these sections to be expanded when the page is loaded?
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/
$( ".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
yes there is active property to determine the default expanded section
you can see it here active
精彩评论