Hi have two content sections and i only want 1 open at a time. They both collapse and open based on clicking the headings. I have it currently working where they are independent of each other but i am looking to have them hide the other when it is shown. I dont want to have to use the plugin for jquery accordion.
here is the code i have now:
HTML:
<div class="topCats">
<h4><a href="#" class="openBox">Most Searched Categories</a></h4>
</div>
<div id="topCatsContainer">
content 1
</div>
<div class="allCats">
<h4><a href="#" class="closed">All Categories</a></h4>
</div>
<div id="allCatsContainer">
content 2
</div>
JS:
$('#allCatsContainer').css("display", "none");
$('.topCats h4 a').click( function() {
$('#topCatsContainer').slideToggle(500);
$(this).toggleClass("openBox");
});
$('.allCats h4 a').click( function() {
$('#allCatsContainer').slideToggle(500);
$(this).toggleClass("openBox");
});
Any help would be greatly appreciated.
Thanks