Jump to content
Search Community

Rerun animation on click after closing menu

Daniel2024 test
Moderator Tag

Recommended Posts

Hello guys,


I am trying to animate a menu, with two different timelines (open and close). Everything works fine.

There still one little issue I need to solve: 

After closing the menu and toggle the  button to open the menu, the open-animation doesn't work / run.


Here is my code:

menuIcon.addEventListener('click', MenuAnimation);
var menuState = 0;
function MenuAnimation(){
if(menuState == 0 ){
menuState = 1;
} else if(menuState == 1){
menuState = 0;


Thank you in advance.





See the Pen abbgBKq by Daniel2024 (@Daniel2024) on CodePen

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...