常见页面元素遮住菜单解决方法

1.被Flash挡住
设置Flash的参数:

1<param name="wmode" value="opaque"/>
1<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" height="60" width="468"><param name="movie" value="http://pepsi.flash8.net/pepsi46860.swf"/>
2<param name="wmode" value="opaque"/><param name="quality" value="high"/><embed height="60" pluginspage="http://www.macromedia.com/go/getflashplayer" quality="high" src="http://pepsi.flash8.net/pepsi46860.swf" type="application/x-shockwave-flash" width="468"/></object>
1<div style="position:absolute;left:150;top:50;width:100px;height:50px;background:green">
2</div>

或者用

1<param name="wmode" value="transparent"/>
1<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" height="60" width="468"><param name="movie" value="http://pepsi.flash8.net/pepsi46860.swf"/>
2<param name="wmode" value="transparent"/><param name="quality" value="high"/><embed height="60" pluginspage="http://www.macromedia.com/go/getflashplayer" quality="high" src="http://pepsi.flash8.net/pepsi46860.swf" type="application/x-shockwave-flash" width="468"/></object>
1<div style="position:absolute;left:150;top:50;width:100px;height:50px;background:green">
2</div>

2.被图片挡住
这个估计是因为图片也放在层中,而图片所在层的Z轴索引值比该层大,所以被挡住,解决办法是更改该层的Z轴索引值至比图片层大。

1<div style="position:absolute;left:0;top:20;z-index:2;background:red;width:120px;height:70px">   
21<img src="http://www.flash8.net/images/logo.gif"/>
3</div>
1<div style="position:absolute;left:50;top:50;z-index:2;background:green;width:120px;height:70px">   
22<img src="http://www.flash8.net/images/logo.gif"/>
3</div>
1<div style="position:absolute;left:90;top:80;z-index:2;background:blue;width:120px;height:70px">   
23<img src="http://www.flash8.net/images/logo.gif"/>
3</div>

3.被表单控件挡住
这个目前还没有完美的解决方法,一般都是在设计排版时就尽量避免这种情况,如果是万不得已,就在层经过表单控件时让表单控件隐藏,过后再让它显示:

1<button onclick="oSelect.style.display='none';oLayer.style.display='inline'">显示层隐藏下拉选项</button>
1<button onclick="oSelect.style.display='inline';oLayer.style.display='none'">显示下拉选项隐藏层</button>
1<div style="position:absolute;left:0;top:50;z-index:2;background:red;width:120px;height:50px">   
2z-index:1<select id="oSelect"></select>
3</div>
1<div id="oLayer" style="position:absolute;left:30;top:60;z-index:2;background:green;width:120px;height:70px;display:none">   
2z-index:2<img src="http://www.flash8.net/images/logo.gif"/>
3</div>

当然还有用优先级别较高的控件来代替层的方法解决,但控件并非是每台机器上都有安装,而且控件的可定制性也差,也就是常说的兼容性问题:
hhctrl.ocx

1<object classid="clsid:adb880a6-d8ff-11cf-9377-00aa003b7a11" codebase="&lt;I&gt;file:&lt;/I&gt;hhctrl.ocx#Version=4,0,0,24" height="20" id="hhctrl" type="application/x-oleobject" width="80">
2<param name="Command" value="Related Topics, MENU"/>
3<param name="Button" value="Menu"/>
4<param name="Item1" value="[X-Eyes];  http://x-lover.com/forums/  "/>
5<param name="Item2" value="闪客之吧;  http://www.flash8.net  "/>
6<param name="Item3" value="零刻联盟;  http://www.linkmeng.com/  "/>
7<param name="Item4" value="蓝色理想;  http://www.blueidea.com/  "/>
8<param http:="" name="Item5" value="&lt;a href=" www.5d.cn"=""/>5D多媒体;  http://www.5d.cn  "&gt;   
9</object>
1<select></select>

window.createPopup()窗口(需要IE5.5+支持)

1<script>   
2var oPopup = window.createPopup();   
3function showPopupWin(){   
4var oPopBody = oPopup.document.body;   
5oPopBody.style.backgroundColor = "green";   
6oPopup.show(50, 120, 180, 65,document.body);   
7}   
8</script>
1<button onclick="showPopupWin()">Click Me!</button>
1<select></select>
1<iframe src="index.asp"></iframe>
Published At
Categories with 网页设计
Tagged with
comments powered by Disqus