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('fast');
    }); 
});


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 visible. How do I achieve this? "toggleClass" did not help
> either.
> 
> Thank you very much for your help!
> 

-- 
View this message in context: 
http://www.nabble.com/Accordion-Like-Menu%3A-Setting-%28and-removing%29-class-on-active-item-tf4507452s15494.html#a12864566
Sent from the JQuery mailing list archive at Nabble.com.

Reply via email to