[jQuery] Re: Accordion-Like Menu: Setting (and removing) class on active item

2007-09-24 Thread Moogadelic
Moogadelic wrote: > > Hi > > I tried to put together an easy accordion-like effect: > > http://www.smartforce.ch/jquery/ShowHide.html > > There is one problem: the selected-class will not be removed if all > items are closed (again). The class ".selected" should be removed if > no div is vis

[jQuery] Re: Accordion-Like Menu: Setting (and removing) class on active item

2007-09-24 Thread Wizzud
You could try... $(document).ready(function() { $('div.showHide> div').hide(); $('div.showHide> h2').click(function() { $(this).siblings('.selected').andSelf().toggleClass('selected').end().end() .next('div').slideToggle('fast') .siblings('div:visible').slideUp('fas