(Firstly, I would like to apologize if my English is bad sometimes, I am French, so it is difficult to explain in detail)
I work on a personal website, but I had a problem with my responsive navigation.
I made a media query for a screen size under 1024px.
When I am above 1024 pixels, I have a regular navigation bar with a list. When I'm under 1024px, I got a small menu logo that appears, and a click event on it causes all the menus to appear and disappear.
But the problem is that if my menu is closed and I expand my window above 1024 pixels, the list does not appear, and I do not know how to deal with this problem.
Here is my code:
<nav class="fixed_nav"> <div id="nav_left"> <img id="logo_nav" src="img/mini_trombi.png" alt="logo"/> <p id="txt_nav">123</p> </div> <ul class="topnav"> <div id="show_n_hide_nav" class="responsive_link_bg"> <li><a id="top_nav_link" class="nav_links" href="#">ITEM 1</a></li> <hr class="responsive_separator"> <li><a class="nav_links" href="#">ITEM 2</a></li> <hr class="responsive_separator"> <li><a class="nav_links" href="#">ITEM 3</a></li> </div> <li class="icon"> <a div id="button_nav" class="menu_icon" href="javascript:void(0);">☰</a> </li> </ul> </nav>
JQuery for click:
$(function(){ $("#button_nav").click(function () { if(!$("#show_n_hide_nav").is(":visible")){ $("#show_n_hide_nav").slideDown("slow"); } else { $("#show_n_hide_nav").slideUp("slow"); } }); });
In my css, I hide the source list below 1024 pixels and show it with jquery when users click on the menu logo.
Again, sorry if this is hard to understand.
source share