Mobile Navigation Menu Not Closing After Section Link Click

I’ve added section links to the navigation menu on mobile, but after clicking a link to navigate to a section, the navigation menu remains visible instead of closing automatically.

  • After navigating to a section, the navigation menu does not hide.
  • The menu stays visible even after moving to the targeted section on mobile.
  • The menu should automatically close after clicking on a section link, but it’s not happening.

Could you please assist me with ensuring that the navigation menu automatically closes after section navigation on mobile? Thank you!


Here is my public share link: LINK

Hi there,

While the navigation menu can be manually opened and closed using the hamburger menu on tablet breakpoints and below, you can implement automatic closing behavior using custom code. One approach is to add a simple JavaScript interaction that triggers the nav menu to close when navigation links are clicked.

You can achieve this by:

  1. Adding a custom code block to your site
  2. Creating an interaction that targets your navigation menu links
  3. Adding JavaScript that closes the menu when these links are clicked

For a code-free alternative, you can use Webflow’s built-in interactions to create a similar effect by adding click triggers to each navigation link that toggles the menu’s visibility.

Hopefully this helps! If you still need assistance, please reply here so somebody from the community can help.

1 Like

I’d like to get more details on how to implement the feature where the navigation menu automatically closes when a link is clicked using Webflow’s built-in interactions. Specifically, I would like to know how to set this up so that it only applies to tablet and mobile breakpoints.

Additionally, if there are any specific considerations or best practices when applying this interaction, I’d appreciate it if you could share that information as well.

Looking forward to your reply. Thank you!

Hello, same problem here, I would appreciate some more details on the custom code and the java script to close the menu. Any help would be really great!!
Thanks in advance

Hey @webflow_hamburg,

If you are using a built-in navbar in Webflow, the Navbar should be able to handle the closing of the menu automatically when any item is clicked in it.

If you have built a custom navigation bar, instead of custom code, you could also setup an interaction to close the menu view when an item is clicked from it.

If you have set the interaction and it still is not reflecting on the site, you can share a read-only link of the site to troubleshoot it in a better way.

Thanks, here the read-only link as I don’t realy know, how to set up the interaction. The main menu links are working and the menu will close, once clicked, but the submenu doesn’t close. These should go to a section on a seperate page.
Thanks in advance!

@webflow_hamburg, I am not able to test the published site since its password protected. So when I try to navigate to any menu link, it takes me to the enter password page. Is there a way for me to test the experience you are facing? That way, I can suggest some interaction or settings accordingly.

By taking a look at the preview link, it does look like you are using a built-in navbar, so the closing of the menu should work by default. But I am not able to test the menu from my end as of now.

Ok, thanks, the site is not protected now, it’s live now!
If needed, I could give you admin rights… The issue is only on mobile view.

Hi all, just try to check this topic: Anchor Links won't close menu (tried all the fixes) - #2 by memetican

2 Likes

Thanks! It works… more or less, not always. And the hamburger menu moves far to the right after clicking.
Any ideas?
Thanks in advance

Hey @webflow_hamburg ,

I can see that the hamburger menu is on the far right even before clicking the menu, and found that there is a footer element which is taking up the space leading to horizontal scroll.

Can you set the direction as highlighted for the Container element in the footer and see if it works?

At the first try fix the layout in footer:

Also in nav dropdown you have the strange structure — link in toggle here:

So need to create a perfect layout and then try how works closing menu with anchor links💁‍♂️

1 Like

Working!!! Thank you mate!!

2 Likes