程晓晖

博客园 首页 新随笔 联系 订阅 管理

bgiframe 插件用来轻松解决 IE6 z-index 的问题,如果网页上有浮动区块和下拉选单重叠时,在IE6会看到下拉选框总是把浮动区块覆盖住,无论怎么调整 z-index 都是没用的,而用 bgiframe 就可以轻松解决这个问题。

使用方法:

$(document).ready(function() { 
  $('#floatingBox').bgiframe(); 
});

 

DIV层遮罩效果原理:

使用一个比需要被遮罩的div层大一些的透明的另一个div层覆盖掉需要被遮罩的div层

这样就不能对底层 div里的内容进行操作了

 

Html代码 复制代码
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">  
  2.  <html xmlns="http://www.w3.org/1999/xhtml">  
  3. <head>  
  4. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />  
  5. <title>无标题文档</title>  
  6.   
  7. </head>  
  8.   
  9. <body>  
  10. <div id="ly" style="position: absolute; top: 0px; filter: alpha(opacity=60); background-color: #777;   
  11.         z-index: 2; left: 0px; display: block; width:500px;height:500px;">  
  12.     </div>  
  13. <div style="width:400px;height:400px;z-index:1;border:red solid 1px;position:absolute;top:20px;left:20px;"><input type="text" value="ddd" /></div>  
  14.   
  15. </body>  
  16. </html>  
posted on 2010-11-10 12:16  fumen  阅读(301)  评论(0编辑  收藏  举报