How to hide elements when scrolling to specific section?

I try to write a code function that hides the anchor when it’s scrolling to the first section. But it turns out that my anchor disappears forever.

This is my code and the picture.

// API Reference: Introduction - Velo API Reference - Wix.com
// “Hello, World!” Example: Velo Learning Center

$w . onReady ( function () {
// Write your JavaScript here

// To select an element by ID use: $w("#elementID") 

// Click "Preview" to run your code 

});

export function section1_viewportEnter ( event ) {
$w ( “#anchorMenu1” ). hide ();
}
export function section1_viewportLeave ( event ) {
$w ( “#anchorMenu1” ). show ();
}