Hamburger icon doesn't animate after clicking an anchor

Hey everyone,

I’m having a bit of trouble sorting out the mobile menu button. Right now, it works with a mouse click interaction – the first click on the hamburger icon opens the menu and switches the icon to an ‘X’. The second click closes the menu and changes the ‘X’ back to the hamburger. All good so far.

The problem is with anchor-links. When I click on an anchor, the menu doesn’t close. To fix that, I added an animation to the Nav Links which should close the menu and switch the ‘X’ back to the hamburger. The menu closes, but the ‘X’ sticks around until I click again, and then it finally turns back into the hamburger icon.

I tried adding some JavaScript code I found on the forum, but it didn’t do the trick. I also found this post, but the video isn’t working, and I’m not sure how to apply the solution: Reset hamburger-menu X-animation on anchor link - #9 by spelap

Here is my public share link: [LINK][1]
([how to access public share link][2])