I'm trying to set up a side navbar that show/hide on click on a hamburger icon. Already kinda achieved that, but the problem is that also the li's inside the ul are animating; I see them on transition shrinked and then growing with the nav div. Hoping that you understand what I mean. How can I set this up in order to see only the parent element (sideNav) to 'grow' in width? It's kinda ugly as of now to see that transition on the li's.
I'm working on a theme for a CMS with dynamic content (so most of the elements has already inherited styles, so I'm trying to figure out what cause the animation on the li's), the markup is, more or less, like this.
function openNav() {
document.getElementById("mySidenav").style.width = "250px";
}
.sideNav {
position: fixed;
top: 0;
left: 0;
z-index: 9;
width: 0;
height: 100%;
overflow-x: hidden;
transition: all 0.5s ease;
}
<span id="openMenu" onclick="openNav()">Menu</span>
<nav class="sideNav">
<div class="navBar_primary">
<ul>
<li class="navBar_item">
<a href="#">Item</a>
<ul class="navBar_secondary">
<li class="navBar_item">
<a href="#">Submenu Item</a>
</li>
</ul>
</li>
<li class="navBar_item">
<a href="#">Item 2</a>
</li>
</ul>
</div>
</nav>
Thank you all in advance.