I don’t know if this has been covered by others, but I couldn’t find a similar topic when I searched.
I wanted to have a small site title and logo on the top of every page, but not show it on the home page because I had there a much larger title. So I inserted into the page code on the home page this line:
$w( “#text19,#image6” ).hide();
I found it worked, hiding those two elements on the home page. But if I visited another page after I had visited the home page, the elements were hidden there also unless I refreshed the page. It seemed the hide function was carried over to the new page until it was refreshed.
The only way I could see to stop this happening was to add this line to every other page:
$w( “#text19,#image6” ).show();
This wasn’t too much trouble for me because there were only 11 pages I had to manually add it. But on a larger site it would have been a pain.
I just thought I’d report this little glitch and ask if there is an obvious work around that I have missed? Or should there be some code added in Wix to prevent this?
Hi Samuel, thanks for answering. I am pretty new to Wix, so I may not know what I am doing.
I have a header with menu, site name and logo. I want to hide the sitename and logo on the home page. I looked up how to do that, and it suggested adding the function I used to the home page code, which I have done. I didn’t know there was also site code.
I can see how your code would work, by making the command conditional. I presume that would mean I would only need to put that code in the home page code area? And if the code remained when I moved to another page, it wouldn’t hide those elements?
If that’s how it works, then I can see it is a better way to do it than I have done. Thanks.
PS Is it intended that code I place on one page will keep “working” when I jump to another page? Or is that an unintended consequence that would be better changed somehow?
Hi Uklee,
you will have to put the code in the site code not the homepage code.
if you put this code in your onReady function from the site code it will always be called on load(evry page)
if you put it in your homepage code it will be called when you go to your homepage code
but when changing to another page it won’t call this anymore so it won’t change back after been hiden.
Thank you. I didn’t know there was site code, and I didn’t understand how the hide and show functions work in page code. I can easily do what you and Samuel say.