Hide element flickering

Hi guys, i need help.
I want to do a very simple code, hide and show a button when the website is scrolling.
My button are pin in the homepage. (www.vincenzotortora.com)

and i wrote this code:
export function button7_viewportEnter(event) {
$w(‘#button7’).hide();
//Add your code for this event here:
}

export function button7_viewportLeave(event) {
$w(‘#button7’).show();
//Add your code for this event here:
}

(i didn’t use the click “hidden on load” because the animation doesn’t work with it)

The problem is that: the button are not hide in the top of the site but is flickering.
Please can we help me?
Thanks a lot,
Vincenzo.

The code should work, try unpinning the element as that might be affecting it.

Thank u so much it works.