Hello, I'm new to GSAP and JS in general, but I wanted to add animation to my burger menu on click.
let typeSplit = new SplitType(".mobile-menu-page-container", {
types: "lines, words, chars",
tagName: "span",
});
// plain JavaScript version
document.querySelector(".burger-wrap").addEventListener("click", function () {
setTimeout(function() {
gsap.from(".mobile-menu-page-txt .char", {
y: "110%",
opacity: 1,
rotationZ: "10",
duration: 0.2,
ease: "power1.out",
stagger: 0.05,
});
}, 200);
});
Everything works on the first click, but if I open and close the menu, it looks strange. What can I do?
Thanks
RPReplay_Final1706268273.mp4