歡迎大家在這裡學習如何實現DIV遮罩層!這裡是我們給大家整理出來的精彩內容。我相信,這些問題也肯定是很多朋友在關心的,所以我就給大家談談這個!
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN">
<html xmlns="">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>遮罩</title>
<style>
/*遮罩層*/
#tinybox_1 {
position:absolute;
width:1002px;
height:80px;
background:#FFF;
display: none;
z-index: 99999;
border:5px solid red;
display:none;
text-align:center;
padding:10px
}
#tinybox_1 h4{ display:block; margin:0 auto; width:1002px; line-height:40px}
.main{ width:98%; height:2000px; margin:0 auto; border:2px solid red; }
</style>
<!--遮罩 begin -->
<script type="text/javascript">
function BtHide(id){var Div = document.getElementById(id);if(Div){Div.style.display="none"}}
function BtShow(id){var Div = document.getElementById(id);if(Div){Div.style.display="block"}}
function BtPopload(showId){
// 高度減去 4px,避免在頁面無滾動條時顯示遮罩後出現流動條
var h = (Math.max(document.documentElement.scrollHeight,document.documentElement.clientHeight) - 4) + 'px';
var w = document.documentElement.scrollWidth + 'px';
var popCss = "background:#000;opacity:0.3;filter:alpha(opacity=30);position:absolute;left:0;top:0;overflow:hidden;border:0"//遮罩背景
var rePosition_mask = function() {
pop_Box.style.height = h;
pop_Box.style.width = w;
pop_Iframe.style.height = h;
pop_Iframe.style.width = w;
if (document.documentElement.offsetWidth < 950) {
//防止正常寬度下點擊時 在 ff 下出現頁面滾動到頂部
document.documentElement.style.overflowX = "hidden";
}
}