collapsable vertical menu; help tweaking code

Discussion in 'Web Design and Development' started by shecky, Mar 19, 2008.

  1. shecky Guest

    shecky

    Joined:
    May 24, 2003
    Location:
    Obviously you're not a golfer.
    #1
    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?
     
  2. thejadedmonkey macrumors 604

    thejadedmonkey

    Joined:
    May 28, 2005
    Location:
    Pa

Share This Page