Having trouble creating a hamburger menu animation. I've set up two divs - one for the basic horizontal lines and one for the X icon. Using jQuery, I can hide and show them (clicking on the lines hides them and shows the X). But now I want to animate the X drawing both "\" and "/" at the same time from top corner to bottom. Here's what I have so far:
<div class="x">
<div></div>
<div></div>
</div>
And here's the CSS:
.x {
position: fixed;
top:47%;
left: 5%; }
.x div {
width: 40px;
height: 2px;
background-color: #000000; }
.x div:nth-child(1) {
transform: rotate(45deg); }
.x div:nth-child(2) {
transform: rotate(-45deg); }
I tried animating by changing width from 0 (0%) to 40px (100%), but because of the transform property it doesn't behave as desired. Any help is greatly appreciated, my apologies for my poor explanation.