I'm developing a responsive menu and it works normally, when it enters the media query for tablet it hides the menu and it is only possible to visualize it through the click of the button, however when the menu is hidden and I return to desktop resolution the menu remains hidden. However if I leave the active menu in tablet resolution and go to desktop there is the menu.
Code sample:
$(document).ready(function() {
$('button').click(function(){
$('nav').toggle();
});
});
* {
outline: none;
text-decoration: none !important;
list-style: none;
}
nav {
background-color: #f2f2f2;
height: 40px;
}
ul {
}
li {
width: 150px;
display: inline-block;
}
a {
color: black;
}
button {
display: none !important;
}
@media screen and (max-width: 786px) {
button {
display: block !important;
}
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script><body><header><nav><ul><li><ahref="#">Início</a></li>
<li><a href="#">Sobre</a></li>
<li><a href="#">Contato</a></li>
<li><a href="#">Serviços</a></li>
<li><a href="#">Cadastre-se</a></li>
</ul>
</nav>
<button class="btn btn-primary">Menu Responsivo</button>
</header>
</body>