Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

shecky

Guest
Original poster
May 24, 2003
2,580
5
Obviously you're not a golfer.
thanks to a gracious user on another forum, i found this code for a collapsable vertical menu for use on my indexhibit site using javascript and jquery:

Code:
$(document).ready(function()
{
	// First we hide all exhibitis

	$("#menu ul li.section-title").nextAll().hide();

	// then the active exhibit is showed

	$("#menu ul").each(function(){
	$(this).find("li.active").prevAll().nextAll().show();
	}); 

	//This is the toggle function

	$("#menu ul li.section-title").click(function(){
	$(this).nextAll().slideToggle("fast");
	
	});
	
});

he uses it on his site here.

one thing i am trying to tweak is to have it automatically close an open section when clicking on a new section; so if i was on "print", clicking "screen" would open "screen" and close "print" automatically.

i am sure its one simple line of code but i have no clue how to do that. any ideas?
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.