Can anyone help me with animating the mobile menu when I click the menu icon?
This is what I have for the menu:
.overlay-menu {
position: fixed;
display: none;
z-index : 1040;
width: 100vw;
height: 100vh;
background: rgba(0, 0,0, 0.5);
top : 0;
left : 0;
}
.mobile-menu {
position: fixed;
display: none;
z-index: 1050 ;
top: 0;
left: 0;
background: white;
width: 50%;
height: 100vh;
text-align: center;
overflow-x: hidden;
}
I'm displaying the overlay when I open the menu using JavaScript.
I also tried adding a transition
to the mobile-menu
class but it's not working.
-webkit-transition: all 0.2s;
transition: all 0.2s;
The mobile navigation:
<nav class="mobile-menu shadow-sm" id="mobile-menu">
<ul class="navbar-nav ml-auto">
<li class="nav-item active">
<a class="nav-link" href="#">test</a>
</li>
</ul>
</nav>
I am using Bootstrap 4 and added this menu below the main menu, along with media queries to hide it on larger devices. Is there anything wrong that I'm doing here? Any help would be appreciated as I am still learning.