How to close mobile menu on Dawn theme after clicking a menu item?

Hello community,

I’m using anchor links on the menu and the issue is that, when clicked, the menu won’t close on the mobile version.

I would like to find a solution, that would close the menu, after any menu item is clicked.

STORE URL: https://dreamcommerce.lv/

Thank you

Kind Regards,

Andrew

Hi @AndrewOne

Could you share your store URL?

https://dreamcommerce.lv/

Hi, you can try to add this jQuery code at the bottom of your theme.liquid file before tag


Thank you for your reply.

I have added jQuery code, but unfortunately it didn’t solve the issue..

Please try to add this script above previous code


So the code look like this


Thank you for your reply.

I tried and inserted the code above.

It seems to work and menu is closing after a click, BUT

after I click on the menu item it navigates me to a different page, not to the anchor I set up at first place.

Do you know the reason why?

You can try to update code like this and check again


Unfortunately, didn’t work. Now the menu isn’t closing and navigation isn’t working as well. :disappointed_face:

Can I sent request to access your store so I can try to help you?

thank you, let’s try.

Hi, I sent request, please approve it.

Should be approved now.

I got it, let me take a try

Hi @AndrewOne

Could you check if it is ok now?

Thank you very much for your time & patience.

It works well now!

1 Like

Happy I could help :heart: !

1 Like

For anyone who may be looking for what was changed to fix the issue by Dan-From-Ryviu. Here it is:


The issue, at least what I found on my end, was the selector .header__icon .icon-close.

Double check to see what the actual element is responsible for closing the mobile menu. For my Dawn theme it was .header__icon–menu listed as the correct selector. You can locate it in the inspect element.

1 Like

hi vrago,

I put this code on my theme.liquid file but its not working on my dawn theme. Can you please check here is the link of my website https://drinktwodrums.com/ @VRAGO

Hi @Mohsin_Khan

You can try to update the code like this