I'm trying to get a jQuery UI Accordion, with initi开发者_开发技巧ally all divs collapsed.
The doc says
// getter
var active = $('#div0').accordion('option', 'active');
// setter
$('#div0').accordion('option', 'active', -1);
Neither of these was working in v1.7.2. The getter always returned null, and the setter had no effect.
I found this bug: http://dev.jqueryui.com/ticket/4576 , which included a fix for the getter.
But the setter still doesn't work.
Anyone have a fix for the setter?
Did you try initializing the accordion with just the active
option?
$('#div0').accordion({active: 1});
Or use the activate method. Checkout the docs - http://docs.jquery.com/UI/Accordion#method-activate
$('#div0').accordion('activate', 1);
I'm not sure how to set arbitrary indexes as open, but...
I can create a create an accordion with nothing open, via:
$(document).ready(function() {
$('#div0').accordion({collapsible:true, active:false});
});
精彩评论