How can i fix this jquery script for submenu?
- by Giulio Bambini
This is the code and this is the result: www.studionews24.com you can see test the menu by clicking inside.
$(document).ready(function () {
var $links = $('#menu-menu-1 .menu-item a').click(function () {
var submenu = $(this).next();
$subs.not(submenu).hide()
submenu.toggle(500);
$("#menu-2").slideToggle(300);
});
var $subs = $links.next(); });
The problem is that if I click on the menu it appears the submenu, but if I don't close the submenu that I have open and I open another voice in the menu it doesn't work properly.
If I click another .menu-item a when #menu-2 is open what happens? The script close and open another submenu correctly but my #menu-2 close only close. And then if I close .menu-item a so... #menu-2 open. How can I do to fix?