我想模仿本網站的Javascipt所需的橫幅,並且如果javascript被允許/啓用,則隱藏下面的div,但是我在頁面上獲得了flash/glimps加載。Stack Overflow在支持JavaScript的情況下效果最好Banner
<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:
// 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只有當我把它隱藏
- 但JavaScript必須花一秒鐘才能開始隱藏事物......
我想嘗試阻止橫幅的瞥見,當頁面第一次加載,任何幫助?
右擊這裏,選擇*查看源代碼*,滾動到底部,檢查包含文本「Stack Overflow在JavaScript啓用時效果最好」的代碼。你看到了嗎? – BalusC 2010-06-12 13:32:56