I'm attempting to replicate the required JavaScript banner on this site, and I have the following divs set up to be hidden if JavaScript is allowed/enabled. However, I am experiencing a fleeting glimpse of it upon page load.
<div id="Main_noJS">Craftystuff.com functions best with JavaScript enabled</div>
<div id="PartOfMain_noJS"><br /></div>
CSS:
#Main_noJS {
width: 100%;
height: 23px;
font-family: Arial;
font-size: 111%;
color: White;
font-weight: bold;
background: #AE0000;
text-align: center;
padding-top: 4px;
position: fixed;
z-index: 100;
}
JavaScript:
// hide the "Craftystuff.com functions best with JavaScript enabled" banner, if JavaScript is working
if ($("#Main_noJS")) {
$("#Main_noJS").hide();
// hide the spacer between the main content and banner...
$("#PartOfMain_noJS").hide();
}
So initially, the banner is visible, and only when JavaScript is enabled do I hide it.
- However, there's a slight delay as JavaScript kicks in to hide things...
I'd like to find a way to prevent that initial glimpse of the banner when the page first loads. Any suggestions?