To create a transparent sticky navbar that turns white on scroll, you'll need to use Webflow's interactions (scroll-based animation) to swap styles between your two navbar versions. Since you've already created two navs, here's how to make the effect work smoothly:
1. Set Up the Navbars
- Place both navbars at the top of your homepage inside the same parent section, positioned absolutely or fixed.
- Set Navbar 1 (transparent) to be visible initially and Navbar 2 (white) to be hidden.
- For Navbar 1: Display: Block or Flex, Opacity: 100%
- For Navbar 2: Display: None, Opacity: 0%
- Create a new div block (e.g.,
navbar-scroll-trigger
) and place it under your hero section or wherever you want the navbar to switch. - Give it a height of 1px, width: 100%, and position: absolute or relative depending on your layout.
3. Build a Page Scroll Interaction
- Go to
Interactions (lightning icon)
> Page Trigger > While Page is Scrolling. - Choose Scroll → Scroll Animation.
- Create a new animation (e.g., “Toggle Navbars”).
Within that animation:
- At scroll position 0% (top of page):
- Navbar 1: Opacity 100%, Display: Flex or Block
- Navbar 2: Opacity 0%, Display: None
- At scroll position (e.g., 5–10% depending on when you want to switch):
- Navbar 1: Opacity 0%, Set Display: None at 100% opacity fade-out end
- Navbar 2: Display: Flex or Block first, then Opacity 100%
Note: You might need a slight fade duration (e.g., 0.2s) to make the transition smooth.
5. Animate Navbar Text and Link Colors (If Needed)
- If each navbar version already has its own styles (e.g., light vs dark), this is handled.
- Alternatively:
- Use a single navbar and animate only the background color and nav element styles.
- In that case, apply background-color transition to the navbar and font-color transitions to text elements.
6. Ensure Both Navbars Are Fixed
- Both navbars should be set to position: fixed at the top (
top: 0
) with a high z-index so they appear over content.
Summary
Use a scroll-based animation on the page or an intersection trigger with a scroll offset div to toggle visibility between your transparent and white navbars. Animate both display and opacity for smooth transitions, and ensure both navbars are fixed and stacked properly. You can use either dual nav elements or a single navbar that changes styles depending on your preference.