Shrinking header works in preview but not on live site

Hello everyone, I have created a new site wit shrinking header. Although this works fine in preview mode, it doesn’t work on live site. I’ve written to Wix Help 2 months ago and still waiting for an answer!
Anyone might be able to help find where the problem is?
I’ve used the following coding on the header (I am not a developer, just an amateur)

export function enter(event) {
$w(‘#blackheader’).hide();
$w(‘#blueheader’).show();
}

export function leave(event) {
$w(‘#blackheader’).show();
$w(‘#blueheader’).hide();
}

Many thanks

https://www.wix.com/corvid/forum/main/comment/5d3f36d5fb41040016316c4d

and anyway you should use viewportEnter() and viewportLeave() not enter() and leave()

  • the element is missing.
    Follow the example in the link above.