堆栈溢出效果最好支持JavaScript的旗帜 [英] Stack Overflow works best with JavaScript enabled banner
本文介绍了堆栈溢出效果最好支持JavaScript的旗帜的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我试图模仿本网站的javascipt的要求旗帜,并有以下的div如果JavaScript允许/启用这些被隐藏,但我得到它的闪存/ glimps在页面加载。
I am trying to mimic this site's Javascipt required banner, and have the below divs which are being hidden if javascript is allowed/enabled, but I am getting a flash/glimps of it on page load.
<div id="Main_noJS">Craftystuff.com works 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的:
JavaScript:
// hide the "Craftystuff.com works 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();
}
所以,旗帜是可见的,开始时,并启动Javascript只有当我把它隐藏
So the banner is visible to start with, and only when javascript is enabled do I hide it
- JavaScript的,但必须采取第二次去上班隐藏的东西...
我想试图阻止的旗帜glimps,当第一次加载页面,任何帮助?
I would like to try to stop the glimps of the banner, when the page first loads, any help?
推荐答案
把旗帜AA &LT; NOSCRIPT&GT;
标记,记录的这里。
Put the banner in a a <noscript>
tag, documented here.
<noscript>
<div>yada yada yada</div>
</noscript>
这篇关于堆栈溢出效果最好支持JavaScript的旗帜的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文