Frozen header works in preview mode but not in livesite

I used the code to freeze the header of my website.
In the first instance, the header must be transparent and as soon as you scroll, the header turns white. This works in preview mode, but not in the live site. Can someone explain to me step by step what I did wrong?
Preview mode:


In the live site it stays transparant.

This is the code I used:

You should really have your code setup so that the onViewportLeave event is called first and then the onViewportEnter after it, so basically the other way to how you have it set currently.

Also make sure that the onViewport functions must be applied to the ‘Header’ element itself and not any of your strips that you have made for the frozen header.

Plus, also make sure that you have the correct strip set as ‘Hidden on Load’ in the properties panel for it.

Wix have done their own tutorial for this, check yours against their tutorial to see:
https://www.wix.com/corvid/example/Frozen-Header
https://www.youtube.com/watch?v=nBkF-eGI38o

However, please note that this tutorial is supposedly not working with the code shown in the tutorial, although I would set it up via the tutorial first to see if it works for yourself.

It is does not work for you, then simply head over to this previous forum post and see the new code that is required for it to work for you:
https://www.wix.com/corvid/forum/community-discussion/on-scroll-header-menu-works-in-preview-mode-but-not-in-published-site-after-upgrade%3Fpage%3D1%26dl%3D5cbcbf1286c26300307aeb27