I am trying to create a responsive menu with flexbox and I want to animate when it shows up on click on mobile.
<nav class="flex-nav" id="test">
<a href="#" class="toggle-nav"> ☰Menu</a>
<ul id="test">
<li class="item1"><a href="#" >Item1</a></li>
<li class="item2"><a href="#" >Item2</a></li>
<li class="social"><a href="#"><i class="fa fa-linkedin"></i></a></li>
<li class="social"><a href="#"><i class="fa fa-twitter"></i></a></li>
</ul>
</nav>
/CSS Code/
.flex-nav ul{
display:none;
-webkit-transition: all 0.5s ease;
-moz-transition: all 0.5s ease;
-o-transition: all 0.5s ease;
transition: all 0.5s ease;
}
.flex-nav ul.open{
display:flex ;
}
/jQuery/
$(function(){
$('#test').on('click', function(){
$('.flex-nav ul').toggleClass('open');
});
});
Anything I have tried I can't get the animation effect, I tried with the time argument on toggleClass(). Thank You!