PDA

View Full Version : collapsable vertical menu; help tweaking code




shecky
Mar 19, 2008, 08:57 PM
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:

$(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 (http://www.elarcadenoe.es/).

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?



thejadedmonkey
Mar 19, 2008, 09:58 PM
Try this..

http://demos.mootools.net/Accordion

can you adopt that to a menu?