Close mobile menu automatically when clicking on link

Hi,

I am using several anchor links on my website (created through a liquid form) and the following is happening now: If I click on an anchor-link in the menu on my smartphone, the page is scrolled to the right position but the user does not see the scrolling (because menu stays open) and thinks it is not working.

How can I change the hamburger menu to auto-close after I clicked on a link?

Thanks!

Website is https://in2places.de/

Hello @Tim_I2P ,

Add this script just before the in theme.liquid


Thanks @Guleria , I inserted it there but nothing happens unfortunately.

I also found this threat here but not sure where I would insert the code mentioned there. Do you know?
https://community.shopify.com/c/shopify-design/auto-close-mobile-menu-after-clicking-link/td-p/1065238