I have a sidebar menu that opens and closes hidden parts of the page through jQuery. The link both fades the hidden content and also adds and removes a class to the link. So for example the html / css
<ul>
<li><a class="linkOne" href="#">Link One</a></li>
<li><a class="linkTwo" href="#">Link Two</a></li>
</ul>
<div class="linkOneBox">Stuff</div>
<div class="linkTwoBox">Stuff</div>
<style type="text/css">
.linkOneBox,.linkTwoBox {display:none}
.current {background: #fff}
</style>
and the jQuery something like..
$('.linkOne').click(function() {
$('.linkOneBox').fadeToggle();
$(this).toggleClass('current');
return false;
});
Anyways.. my question is, since i am using toggle, what is the best way to have all of the other toggles that were left open reset to off? How would I have it so that clicking a new link also hides all of the previously opened windows and removes the .current ?