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?
Thanks.
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.
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?
When you say "top of every page" you want to say #header ??
so you put your "hide" code in site code or page code? I dont know if I understand what you want to do, but I probable would use something like that: if ($w('#page1').title === "home") { $w("#text19,#image6").hide(); } else {$w("#text19,#image6").show()}