My preview is different then my publish site

Recently, I tried to animate my header by programming it. Everything works when I preview, but when I publish, my animation that I code doesn’t work.

If anyone had an idea how to fix my problem, it would be appreciated.

The preview site:

My code:

It isn’t leave and enter, you need to use onViewport.
https://www.wix.com/corvid/reference/$w.ViewportMixin.html

See here for a Wix Corvid Tutorial.
https://www.wix.com/corvid/forum/corvid-tips-and-updates/fixed-frozen-header-example