DIV CSS 佈局教程網

 DIV+CSS佈局教程網 >> 網頁腳本 >> CSS入門知識 >> CSS進階教程 >> 常見頁面元素遮住菜單解決方法
常見頁面元素遮住菜單解決方法
編輯:CSS進階教程     
1.被Flash擋住
設置Flash的參數:<param name="wmode" value="opaque">
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="468" height="60"><param name="movie" value="http://pepsi.flash8.net/pepsi46860.swf">
<param name="wmode" value="opaque"><param name="quality" value="high"><embed src="http://pepsi.flash8.net/pepsi46860.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="468" height="60"></embed></object>
<div style="position:absolute;left:150;top:50;width:100px;height:50px;background:green">
</div>
或者用<param name="wmode" value="transparent">
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="468" height="60"><param name="movie" value="http://pepsi.flash8.net/pepsi46860.swf">
<param name="wmode" value="transparent"><param name="quality" value="high"><embed src="http://pepsi.flash8.net/pepsi46860.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="468" height="60"></embed></object>
<div style="position:absolute;left:150;top:50;width:100px;height:50px;background:green">
</div>
2.被圖片擋住
這個估計是因為圖片也放在層中,而圖片所在層的Z軸索引值比該層大,所以被擋住,解決辦法是更改該層的Z軸索引值至比圖片層大。
<div style="position:absolute;left:0;top:20;z-index:2;background:red;width:120px;height:70px">
1<img src="http://www.flash8.net/images/logo.gif">
</div>
<div style="position:absolute;left:50;top:50;z-index:2;background:green;width:120px;height:70px">
2<img src="http://www.flash8.net/images/logo.gif">
</div>
<div style="position:absolute;left:90;top:80;z-index:2;background:blue;width:120px;height:70px">
3<img src="http://www.flash8.net/images/logo.gif">
</div>
3.被表單控件擋住
這個目前還沒有完美的解決方法,一般都是在設計排版時就盡量避免這種情況,如果是萬不得已,就在層經過表單控件時讓表單控件隱藏,過後再讓它顯示:
<button onClick="oSelect.style.display='none';oLayer.style.display='inline'">顯示層隱藏下拉選項</button><button onClick="oSelect.style.display='inline';oLayer.style.display='none'">顯示下拉選項隱藏層</button>

<div style="position:absolute;left:0;top:50;z-index:2;background:red;width:120px;height:50px">
z-index:1<select id="oSelect"></select>
</div>
<div id="oLayer" style="position:absolute;left:30;top:60;z-index:2;background:green;width:120px;height:70px;display:none">
z-index:2<img src="http://www.flash8.net/images/logo.gif">
</div>
當然還有用優先級別較高的控件來代替層的方法解決,但控件並非是每台機器上都有安裝,而且控件的可定制性也差,也就是常說的兼容性問題:
hhctrl.ocx
<OBJECT id=hhctrl type="application/x-oleobject" classid="clsid:adb880a6-d8ff-11cf-9377-00aa003b7a11" codebase="<I>file:</I>hhctrl.ocx#Version=4,0,0,24" width=80 height=20>
<PARAM name="Command" value="Related Topics, MENU">
<PARAM name="Button" value="Menu">
<PARAM name="Item1" value="[X-Eyes];http://x-lover.com/forums/">
<PARAM name="Item2" value="閃客之吧;http://www.flash8.net">
<PARAM name="Item3" value="零刻聯盟;http://www.linkmeng.com/">
<PARAM name="Item4" value="藍色理想;http://www.blueidea.com/">
<PARAM name="Item5" value="<a href="http://www.5d.cn">5D多媒體</a>;http://www.5d.cn">
</OBJECT>
<select></select>
window.createPopup()窗口(需要IE5.5+支持)
<SCRIPT>
var oPopup = window.createPopup();
function showPopupWin(){
var oPopBody = oPopup.document.body;
oPopBody.style.backgroundColor = "green";
oPopup.show(50, 120, 180, 65,document.body);
}
</SCRIPT>
<BUTTON onclick="showPopupWin()">Click Me!</BUTTON><select></select>
<iframe src="index.asp"></iframe>
[

XML學習教程| jQuery入門知識| AJAX入門| Dreamweaver教程| Fireworks入門知識| SEO技巧| SEO優化集錦|
Copyright © DIV+CSS佈局教程網 All Rights Reserved