Listen for nav open

Is there a way to listen for when a navigation opens? I want to be able to listen for the navigation opening and then use custom JS to perform actions thereafter.


Here is my public share link: LINK
(how to access public share link)

1 Like

I’m also trying to find some info on this. With how my nav is setup, I have a second logo in an anchor tag inside the open nav menu but it’s not clickable because the z-index of the main navbar container is over it. Need to be listen for the nav open event and toggle the z-index of the main/closed-state navbar container.

Hey Justin, a few things that might help.

First it sounds like your nav bar could be setup better, so I’d look for a design arrangement solution rather than a codefix. It’s probably not needed.

Second is that when the nav is open it will have some special classes applied to it. You could utilize this in a custom style chunk that adjusts your logo z-index only when a nav ( or a specific nav ) is open. Look into the CSS :has() pseudoselector.

However if you really needed to do this in JS, the only way to detect an open/close event is to write a mutationobserver to watch for the DOM changes that Webflow.js is making. It doesn’t issue any notifications otherwise.