Sticky Header - something went wrong

Hey.
i try to make sticky header in this page:
https://isstaody.wixsite.com/kfarim/copy-of-home-1

I set the header to be hidden on load and then i put this code on my site:

export function stick1_viewportEnter(event, $w) {
//Add your code for this event here:
$w(‘#stick1’).hide()
}

export function stick1_viewportLeave(event, $w) {
//Add your code for this event here:
$w(‘#stick1’).show()
}
What to do ?
Thanks :slight_smile:

i try to copy-paste the code from here:
https://www.wix.com/wix-code-examples/frozen-header

Hi,
The event listeners should refer to the header (Same as the example) instead of the sticky element.

1 Like

Hi Or.

i think i fix this issue.
maybe you can help me with one more thing?
how can i set the frozen header to be in all pages?
what is the code that i need to put in the site code?

this is the code that i put in the page code:

export function anchorstick_viewportEnter(event) {
//Add your code for this event here:
$w(‘#stick1’).hide()
}

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

You can copy this code to the site code to run on all pages.

1 Like