Is there a way to highlight the "current" menu item as the user scrolls on Webflow while using a sticky menu on the side of the website?

Published on
September 22, 2023

Yes, there is a way to highlight the "current" menu item as the user scrolls on Webflow while using a sticky menu on the side of the website. Here's how you can achieve this:

  1. Create your sticky menu: Design and style your menu element as a sticky element on the side of your website using the Webflow Designer.
  2. Select the menu items: Select each menu item within your sticky menu element using the Webflow Designer.
  3. Add a custom attribute: In the Settings panel for each menu item, add a custom attribute called "data-scroll-target" and set a unique value for each menu item. This value will be used to link your menu item to the corresponding section on the page.
  4. Add interactions: Open the Interactions panel and create a new interaction for your sticky menu.
  5. Add a scroll trigger: Within the interaction, add a Scroll Trigger and set it to the appropriate scroll offset you want the menu to start highlighting.
  6. Create an action: Add an action to the Scroll Trigger called "Add class". Select the current menu item and choose the class you want to apply to it, which will be used for highlighting.
  7. Create a second action: Add another action to the Scroll Trigger called "Remove class". Select all the other menu items and choose the class you want to remove from them, so only the current menu item is highlighted.
  8. Set the scroll step: Specify the scroll step in the Scroll Trigger settings. This value will determine the accuracy of the active menu item as the user scrolls.
  9. Repeat for each menu item: Repeat the previous steps for each menu item in your sticky menu, adjusting the scroll offset and target sections accordingly.
  10. Preview and publish: Preview your site in the Webflow Designer to see the menu highlighting in action. Make any necessary adjustments, and then publish your site.

By following these steps, you can ensure that the "current" menu item in your sticky menu is highlighted as the user scrolls through your website. This provides a seamless and intuitive navigation experience.

Additional Questions:

  • How do I create a sticky menu in Webflow?
  • Can I use different animations for the sticky menu in Webflow?
  • How can I optimize my Webflow website for SEO?