I'm new with jQuery code.. I tried to develop a "full page menu" by me but i have some difficulty to hide menù on second click.. i tried .toggle() but i read that was retired.. can you help me? thank you so much and sorry for my bad english.
HTML
<div class="container">
<a id="bars" href="#">Apri/Chiudi Menù</a>
</div>
<nav id="nav" class="nav-default">
<ul>
<li>Home</li>
<li>Servizi</li>
<li>Portfolio</li>
<li>Contatti</li>
</ul>
</nav>
CSS
#bars {
position: fixed;
z-index: 2;
}
#nav {
position: absolute;
width: 100%;
height: 100%;
text-align: center;
}
#nav ul {
list-style: none;
}
.nav-default {
left: -100%;
top:0;
background: #ccc;
}
jQuery
$(document).ready(function() {
$("#bars").click(
function (){
$(".nav-default").animate({
left: "0"
}, 1000, function() {
// Animation complete.
});
});
});
PS Whit this code when i click menù only reveal!