Webflow Fixes

Close dropdown menu on anchor link click

Overview
Webflow Designer fixes
Removing "Rogue" Conjoined Text Elements
Intro
7:30
005
Resolving Compound Class & Global Class Conflicts
Intro
7:41
006
Something Is Broken!
Intro
7:41
007
Navbar fixes
Close dropdown menu on anchor link click
Intro
100
Scroll-to-section at the correct page location
Intro
4:26
101
Site Search fixes
Remove SKU Items from Search Results
Intro
200
No items found.

If you have a section anchor link inside of a dropdown menu, then when you click it the browser scrolls the page without closing the menu first.

This seems to happen most often when the menu is set to open on hover.

Add this small piece of script in the </body> custom code of your site to remedy this.

How it works;

  • Detects clicks specifically on anchor links, since the href="#...
  • Finds its parent nav element and removes w--open class
  • Finds its parent dropdown toggle and removes the w--open class

Tested;

  • chrome windows
  • chrome mobile

References

https://discourse.webflow.com/t/close-dropdown-menu/74499

https://discourse.webflow.com/t/ability-to-close-dropdown-menu-after-link-is-clicked/5581/24

Table of Contents
Comments
Did we just make your life better?
Passion drives our long hours and late nights supporting the Webflow community. Click the button to show your love.