In preview, they work fine, but in production they are never called. I’ve even tried adding this in case they weren’t being registered properly properly, with the same result:
$w.onReady(function () {
$w('#id').onViewportEnter(item_viewportEnter);
$w('#id').onViewportLeave(item_viewportLeave);
});
Anyone have any ideas about how to fix this? I saw an earlier very similar question from February but there wasn’t any fix, it was just resolved for the OP.
Anyone from wix have any ideas? This is impacting my site and I don’t appreciate paying for something broken…
Are you talking about Wix’s own Frozen Header tutorial here - Frozen Header
As a fix for this was already posted months ago now and is here.
https://www.wix.com/corvid/forum/community-discussion/fixed-frozen-header-example
As for the onviewports themselves, thr API reference is here.
https://www.wix.com/corvid/reference/$w.ViewportMixin.html
You need to be calling them separately with each export function being added through the onViewport event handler in the elements properties panel.
https://support.wix.com/en/article/corvid-working-with-the-properties-panel
https://support.wix.com/en/article/corvid-tutorial-adding-custom-interactivity-with-events
So it would be looking something like this.
export function transparentStrip_viewportEnter(event) {
$w('#stickyHeaderWhite').hide();
}
export function transparentStrip_viewportLeave(event) {
$w('#stickyHeaderWhite').show();
}
Ah, thanks @givemeawhisky ! Adding a strip as suggested in the “Fixed-frozen-header-example” did the trick, although it’s annoying that the youtube video and page explaining it are wrong, and haven’t been updated. The people from wix should really at at the very least put that in the video description, and ideally fix the video as well…
@deleteduser Thanks for the comment. I’ve resolved it now with someone else’s help, but if you still want to check the site out it’s kokuadog.com