I'm using this to expand or collapse some div
$("h3.trigger").click(function(){
$(this).toggleClass("active").next().fadeToggle(500,"swing");
return false;
});
on this html code
<div class="foo">
<h3 class="trigger active">Test 1</h3>
<div class="block" style="display:block">
<p>Lorem ipsum dolor </p>
</div>
</div>
<div class="foo">
<h3 class="trigger">Test 2</h3>
<div class="block" style="display:none">
<p>Lorem ipsum dolor sit amet</p>
</div>
</div>
<div class="foo">
<h3 class="trigger">Test 3</h3>
<div class="block" style="display:none">
<p>Lorem ipsum dolor sit amet.</p>
</div>
</div>
and everything works fine ;-)
But I would like to be able to collapse all div opened except the one opened by the h3 click !