Click here to Skip to main content
15,936,821 members
Please Sign up or sign in to vote.
2.00/5 (4 votes)
We are given a task to make Who Winked Me[^] responsive..we have done all the things but one is left.
we want to make the menu panel auto hide when any menu is selecetd.

What I have tried:

we worked very hard on this but we didn't reach to the goal....
Updated 30-Jun-16 3:25am
TheKarateKid 28-Jun-16 9:28am    
after selection if you hide the Menu panle, how do you want to unhide or make it visible again to select different menu ?

1 solution

I just checked your code present here :[^]

I can see you have used the below code for closing the menu on body click :-
$(".sidr-open #main-nav").click();

So, you can do the following to achieve the one you want.

1. Add hideMenu(); onclick method for all your menu list like :-

<a href="#Home" onclick="hideMenu();">...</a>
<a href="#About" onclick="hideMenu();">...</a>
<a href="#Share" onclick="hideMenu();">...</a>
<a href="#Screenshots" onclick="hideMenu();">...</a>
<a href="#Download" onclick="hideMenu();">...</a>
<a href="#Video" onclick="hideMenu();">...</a>
<a href="#Contact" onclick="hideMenu();">...</a>

2. Then add the definition for hideMenu() function like :-
function hideMenu() {
    $(".sidr-open #main-nav").click();

Done !! Now the menu bar will hide automatically on selecting any of the menu in the list.

Hope this will help you :).
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900