2

I have a CSS dropdown menu that is functioning how I want it to except for one part, clicking on one of the submenu items does not close the submenu.

Most people probably don't care about this because each link will take them to a new page, but mine just stays on the same page and calls a javascript function.

Using jquery, I am able to hide the submenus on click like so:

        $("ul.pureCssMenu li a").live('click', function() {
            $("li.pureCssMenui").hide();
        });

However after one submenu is clicked on, all submenus are now hidden forever. Is there a way to unhide it without doing something cheesy like a timer? Or a better way to approach this in general?

Here is the page I'm working on: http://www.nba.com/warriors/wallpapertest_031.html

Thanks in advance.

2 Answers 2

1

You should hide the < UL > inside not the < LI > so something like this

$("ul.pureCssMenu li a").live('click', function() {
            $("li.pureCssMenui ul").hide();
 });
Sign up to request clarification or add additional context in comments.

Comments

1

For unhiding you can simply use

$("li.pureCssMenui").show();

3 Comments

yes but if i put that directly after the .hide() then the menu doesn't disappear at all
@DougieBear I just now browsed to your website and when i clicked on a sub menu...all the sub menu's are still there...can you explain a bit mroe as to what you are trying to acheive here...Thanks...
yeah I'm trying to get rid of that. Tarik's solution worked :). Thanks for the help NiK!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.