Hey Jack3000,
I think what you're kind of after is a more abstracted solution.
I put up a JS Fiddle with an example of a simple menu toggler: http://jsfiddle.net/GeekyJohn/YkFff/
The markup is simple, you have a #menu div that contains links that toggle respective sub menus.
HTML Code:
<div id="content">
<div id="menu">
<a href="#" class="toggler">Toggle Menu</a>
<div class="menu">
<p><a href="#">Link 1</a></p>
<p><a href="#">Link 1</a></p>
<p><a href="#">Link 1</a></p>
</div>
<a href="#" class="toggler">Toggle Menu2</a>
<div class="menu">
<p><a href="#">Link 1</a></p>
<p><a href="#">Link 1</a></p>
<p><a href="#">Link 1</a></p>
</div>
</div>
</div>
The JavaScript to then toggle these menus is incredibly simple
Code javascript:
$(document).ready(function(){
$("#menu").on("click", ".toggler", function(e) { //when a toggler link is clicked
e.preventDefault();
$(this).toggleClass("active").next(".menu").slideToggle(); //slideToggle the menu it belongs to.
});
$(".menu").hide(); //hide all menus to start out with
});
It's of course trivial to swap out the effect for something else.
Take a look at the JS Fiddle for a working example.
Bookmarks