PDA

View Full Version : Menu closing



kimikai
04-28-2012, 01:37 PM
Ive been working on a dropdown menu,
and ive got it all working now, except for the thing that i want the submenu to stay open untill you click on a new mainmenu button.
Right now its like when you click on a submenu button the submenu will close.
The part of javascript is this

$(document).ready(function () {

$('#accordion a.item').click(function () {

//slideup or hide all the Submenu
$('#accordion li').children('ul').slideUp('fast');

//remove all the "Over" class, so that the arrow reset to default
$('#accordion a.item').each(function () {
if ($(this).attr('rel')!='') {
$(this).removeClass($(this).attr('rel') + 'Over');
}
});

//show the selected submenu
$(this).siblings('ul').slideDown('fast');

//add "Over" class, so that the arrow pointing down
$(this).children('a').addClass($(this).children('li a').attr('rel') + 'Over');

return true;
I came to the conclusion that when i delet the //slidup or hide all the submenu part, it wont close when you click on a submenu, but it wont close either when you click on a new mainmenu button.

I am really a nuub when it comes to javascript, so i have a hard time reading it and all.
My question therefor is, how am i going to change the slideup part so it will only start sliding up when a new mainmenu button is being clicked on?