How to hide navbar when an element is scrolled into view?

Hello! I love the navigation bar that https://diagram.com/ has where a secondary navigation bar appears from the top of the viewport when the “magic wand” element is scrolled into view.

I implemented this onto my own website, but I’m having trouble hiding the navbar once I scroll up to a specific element.

Currently, the secondary navbar appears when the .portfolio_component is scrolled into view, offset by 50%.

I want the navbar to hide when I scroll up and reach the .portfolio_component element again. How do I implement this?

Thank you so much for your help :slight_smile:


Here is my public share link: Webflow - Tak's Portfolio
(how to access public share link)