Make Your Site Respond when Elements Scroll into View

Hey @emaildevonbatista ,

I think the problem is that you’ve set the menu to show on viewportEnter for anchor6, but anchor6 is already in the viewport when the page loads, so the menu shows.

Viewport enter creates a reaction when a user scrolls something into view on the screen that was previously off-screen. Whatever code you put in that function (export function anchor6_viewportEnter) is going to run when that element is in view. In your case the anchor is in view when the page loads so your menu gets shown.

If you move the anchors that you want to control the menu visibility to somewhere “beneath the fold” - meaning to a place where users have to scroll to see them, you’ll see things working the way you want. You just need to figure out the exact placement of the anchors.

This should fix things. If not let me know and I may be able to drill down some more.

-Jeff