Hi all, I’m having some issues with a fairly simple code. I’d like a gallery and text displayed on every page except for the Home page.
$w.onReady( function () {
//Hides the element when the page loads
$w(“#gallery5, #text19”).hide();
This is the code for that action. However, if I navigate THROUGH the homepage to the rest of the website, the gallery and text never appear. If I type in the URL of specific pages, the gallery and text re-appear (examples of each below).
Does anyone know how to fix this quirk?
The code for this should only be placed on your page tab for your home page.
$w.onReady(function () {
//Hides these elements when the page loads
$w("#text19").hide();
$w("#gallery5").hide();
});
//Ignore the double element add, it is a well known forum bug.
OR
$w.onReady(function () {
//Hides these elements when the page loads
$w("#gallery5, #text19").hide();
});
Also, if you have used the ‘show on all pages’ toggle for that element, then the code will apply to all the pages too.
Have a look at this tutorial here.
https://support.wix.com/en/article/corvid-tutorial-hiding-an-element-on-certain-pages
Line 5 calls the hide() function, which sets the element’s hidden property to true. This means the element will not be displayed on this page even if the element is set to “Show on all pages”.
If you decide you want to display the element, you can change the hide() function to show() .
Thanks whisky, adding the show() function fixed my problem. Much appreciated!