"Hidden on load" property doesn't work for header after navigating to another page

Hello, I’m trying to set up a box element in my site’s header that would be hidden on load and revealed on a button’s click.

I use the element’s “Hidden on load” property - and that works OK when I load a web page. I click a button to show the box element - everything works good.

However, when I perform transitioning to another site’s page (without reloading, just navigating through web site) a new page’s header has the box element not hidden. That’s not quite what I would expect from the “Hidden on load” property.

I can’t use individual pages’ “$w.onReady()” callback because I want this to have on all pages (that’s why I put it into header).

I would appreciate if anyone points me to what I’m doing wrong or tells me about alternatives how I can achieve the result that I want.

Thank you!

If you have put it in the header then it will apply to all headers on every page, so if you click on a button to show a hidden element, then it will be shown on all other headers on all other pages too.

Obviously, when you reload the page you are reloading and starting again from the beginning so your code will work and your element will be hidden again as it is set to be hidden on load.

If you simply move onto another page after you have clicked the button to show the element, then it will still be shown and not hidden.

Hidden on load is exactly what it says, hidden on load.

Putting it in a header or footer is the same as putting the show on all pages toggle as shown here.
https://support.wix.com/en/article/showing-an-element-on-all-pages-6533570

If you want it to be hidden on every header on every page, regardless of if the button is clicked on one page or not, then look at putting code into your site tab so that when every page opens the code tells the element to be hidden.

See here for working with page and site tabs.
https://support.wix.com/en/article/corvid-working-in-the-code-panel#page-and-site-tabs-1

Thanks for feedback! I’m wondering which callback I should use in the “Site” tab? The “$w.onReady()” is for “Page” tab only, so I don’t know if there is any site-wide callback which is called on each page transition.