.current_page_item is the class that wordpress automatically assigns to the current menu item, and I use the above jquery code to make the First level submenu to appear a selected and open when the user navigates in the current page
But when user is selecting a second level menu although the second level list is expanded the first level hides again…
This is a newbie javascript question, please some advice will be hellpfull
Can you help me understand your problem better? The first thing I did was correct your .sub-menu class (notice the hyphen in your JavaScript versus no-hypen in your HTML).
Doing so, I get the following:
As far as I can tell, it seems to work, what exactly is it that you need help with?
Okay, problem fixed. In short, your #menu ul:visible was targeting ALL menus that were visible (including the parent of a sub-item). I added .not(checkElement.parent().parent()). Now this works for 3 levels, may not work for 4 levels.
For educational purposes, what needs to be added so that you can retain the functionality of the menu, but you can toggle the slideup/down functionality?
Currently, if an element is active you can’t click it to toggle the slide function, you have to click a different element to get it to slide up.