Anchor Menu Appear/Disappear at Select Parts of a Page

I’m trying to create an anchor menu that appears once the user has scrolled to a certain element, and disappears when the user scrolls back past said element. The issue is I’m trying to try together with the documents (that use the deprecated $w field) and the “new” method of object selection, while also being very rusty at coding.

Using the following I built a solution using the “legacy” method:
https://www.wix.com/corvid/reference/$w.ViewportMixin.html
https://www.wix.com/corvid/reference/$w.EffectOptions.html#FadeEffectOptions

let fadeOptions = {
 "duration":   2000,
 "delay":      1000
};

export function WheyProteinHeader_viewportEnter(event) {
    $w("#anchorMenu1").show("fade", fadeOptions);
}

Can someone point me to a demo that doesn’t use the $w value or is deprecation at this point not a concern?

Thanks for any help/suggestions!