1
I am developing a responsive menu and it works normally, when enters the media query for tablet it hides the menu and it is only possible to view it by clicking the button, but when the menu is hidden and back to desktop resolution the menu remains hidden. However if I leave the menu active on the tablet resolution and go to desktop there is the menu.
Code example :
$(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><a href="#">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>
Try using fadeToggle instead of toggle
– Mauro Alexandre
@Mauroalexandre continued the same way,
– Furabio