Webflow Fixes

Close dropdown menu on anchor link click

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

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

FAQs

Answers to frequently asked questions.

Videos
No items found.
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.