覆盖层的css +jquery

2010-07-13 17:19:28 by 【6yang】, 295 visits, 收藏 | 返回

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>6yang 覆盖层的css +jquery</title>
</head>
<style type="text/css">
 body{ background-color:#fff; margin:0; padding:0;  }
 #overlay01{
 background-color:#333;
 height:100%;
 left:0;
 position:absolute;
 top:0;
 width:100%;
 opacity:0.7;
 filter:alpha(opacity=80);
 z-index:10000;
}
 
 #text{
  width:100%;
  background:#f38;
  z-index:1002;
  position:absolute;
  }

</style>
<script src="js/jquery-1.3.2.min.js" type="text/javascript"></script>
<script> 
jQuery(function($){
  //solute Cover layer Background
   var jQObj = $("#overlay01");
  var coverHeight = $(document).height();
  $(window).load(function(){
   minHeightHack(jQObj, coverHeight);
   $(window).resize(function(){
    minHeightHack(jQObj, coverHeight);
   });
  });
 
 
});
 
function minHeightHack(jQObj, coverHeight){  
  jQObj.css("height",coverHeight);
  $("#text").css("height",coverHeight-500);
}
 
</script>
<body>
  <div id="overlay01">your Content</div>
  <div  id="text">your up Content</div>
 
</body>
</html>

分享到:
share

    图片原图

    loading

    loading