Reputation: 3916
I have created an accordion menu. Here is my js code:
var menu = $('ul.menu', '#sidebar');
menu.accordion({
header: '.parent > a',
collapsible: true
});
Here is a recreation of what we have: http://jsfiddle.net/chMPT/
Here's my delima: I want the menu to be completely collapsed by default and I can't change the html structure because the menu is produced by joomla.
I tried using the create method to close the active menu upon the creation of the accordion but it doesn't work right. And here's that code:
var menu = $('ul.menu', '#sidebar');
menu.accordion({
create: function(event, ui) {
menu.accordion("activate" , false);
},
header: '.parent > a',
collapsible: true
});
Any suggestions?
Upvotes: 0
Views: 593
Reputation: 678
its as simple as
menu.accordion({
header:'.parent > a',
collapsible: true,
active:false
});
EDIT: link to jQuery UI doc regarding the active option
Upvotes: 3