Reputation: 3
Demo: http://jsfiddle.net/KevinOrin/LM4Rf/
I would like any current open items to close when I click on a new item. Clicking on a item thats already open should close that item.
Example I click Leadership it opens, clicking it again should close it.
But if I click Leadership and it opens and then click Investments, Leadership should close and Investments should open.
I keep playing with the jQuery but everything I try breaks something else, how do I refactor this?
// OT accordion function
var submenu = $('ul.OT-subCats, ul.OT-subsubCats, .OTToggleHide').hide();
$('#OT-CatAccordion .accSelector').click(function () {
if ($('ul.OT-subCats, ul.OT-subsubCats').is('visible')) {
$('ul.OT-subCats, ul.OT-subsubCats').hide('300');
}
$(this).find('ul.OT-subCats, ul.OT-subsubCats').slideToggle('300');
});
Upvotes: 0
Views: 92