HTML
<div class="container">
<div class="toggle">
<div class="menu-btn">
<span class="one"></span>
<span class="two"></span>
</div>
</div>
</div>
CSS
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
display: grid;
place-items: center;
height: 100vh;
}
div {
position: relative;
z-index: a;
}
.toggle {
position: relative;
}
.menu-btn {
position: fixed;
width: 40px;
height: 12px;
cursor: pointer;
z-index: 10;
}
span {
position: absolute;
width: 100%;
height: 2px;
background-color: #000;
}
.two {
margin-top: 12px;
}
JAVASCRIPT
$(document).ready(function() {
var t1 = new TimelineMax({paused: true});
t1.to('.one', 0.8, {
y: 6,
rotation: 45,
ease: Expo.easeInOut
});
t1.to('.two', 0.8, {
y: -6,
rotation: -45,
ease: Expo.easeInOut,
delay: -0.8
});
t1.reverse();
$(document).on('click', '.menu-btn', function() {
t1.reversed(!t1.reversed());
});
});
I NEED HELP WITH IMPLEMENTING THIS IN REACT:
PLEASE MAKE SURE TO INCLUDE GSAP :
<script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/3.5.1/gsap.min.js"</script>
HERE IS THE LINK TO THE CODEPEN EXAMPLE : https://codepen.io/doesnotexist/pen/XWXKMmJ
When I tried to replicate the behavior in React, I encountered numerous errors which I couldn't resolve.