In Progress

jquery menu - improve code to allow to close

I have some jquery code for an accordion type menu. When a main heading (.menubar) is clicked it closes that one and opens the NEXT (.menubar) in the menu. This is what I want, but I also want it modified so if the same menu is clicked again, it will close that menu that was just clicked. Currently it only closes a menu, when a new one is clicked.

Here is the code that works, but needs to be modified to accommodate that change

$(function(){

$('.menubar').click(function(e){

[url removed, login to view]();

$(".submenu").hide();

$(this).next(".submenu").toggle();

return false;

});

$('.subhead').click(function(e){

[url removed, login to view]();

$(this).next(".submenu").toggle();

return false;

});

});

Skills: AJAX, Javascript, jQuery / Prototype

See more: code that, type code, jquery c, jquery toggle click, jquery menubar, menu code, code function, ajax return, jquery click toggle, javascript toggle, hide code, ajax code, accordion menu click, menu function, allow, jquery toggle, ajax submenu code, ajax submenu, javascript ajax jquery, improve code, menu accordion javascript, menu jquery accordion, javascript code hide, menu accordion, javascript submenu

About the Employer:
( 13 reviews ) Melbourne, Australia

Project ID: #1128441

Awarded to:

maleo

Hi Sir, Ready to work on this.

$30 AUD in 0 days
(65 Reviews)
5.5

4 freelancers are bidding on average $45 for this job

jqMike

Can fix it quickly and professionally. Please contact me.

$70 AUD in 0 days
(53 Reviews)
6.7
tonykim100

Hello sir! Please check PMB.

$50 AUD in 0 days
(40 Reviews)
5.3
itresumesha

i can do it. lets start now

$50 AUD in 0 days
(1 Review)
0.0
amip1987

I can do that

$50 AUD in 1 day
(0 Reviews)
0.0