弹出层覆盖整个页面方法
2014-07-25 17:13
691 查看
弹出层透明背景加框的常用样式和结构
.alertMessageBg{
position:fixed;
_position:absolute;
width:100%;
height:100%;
left:0;
top:0;
background:#000;
opacity:0.5;
-moz-opacity:0.5;
filter:alpha(opacity=50);
z-index:97;
display:none;
}
.alertMessageDivBorder{
position:fixed;
_position:absolute;
width:750px;
height:370px;
left:50%;
top:50%;
margin:-185px 0 0 -375px;
background:#000;
filter:alpha(opacity=30);
-moz-opacity:0.3;
opacity:0.3;
z-index:98;
display:none;
}
.alertMessageDiv{
position:fixed;
_position:absolute;
width:730px;
height:350px;
left:50%;
top:50%;
margin:-175px 0 0 -365px;
background:#fff;
z-index:99;
display:none;
font-size:14px;
}
<div class="alertMessageBg"></div>
<div class="alertMessageDivBorder"></div>
<div class="alertMessageDiv"></div>
弹出层背景覆盖整个网页的方法
1.最近突然想起用的css方法
.alertMessageBg{
position:fixed;
_position:absolute;
width:100%;
height:100%;
left:0;
top:0;
background:#000;
opacity:0.5;
-moz-opacity:0.5;
filter:alpha(opacity=50);
z-index:97;
display:none;
}
2.js方法
.alertMessageBg{
position:absolute;
width:100%;
height:100%;
left:0;
top:0;
background:#000;
opacity:0.5;
-moz-opacity:0.5;
filter:alpha(opacity=50);
z-index:97;
display:none;
}
var bgWidth = document.body.clientWidth + 'px',
bgHeight = document.body.clientHeight + 'px',
alertBgNode = $('.alertMessageBg');
alertBgNode.css({'width':bgWidth,'height':bgHeight});
对比以上两种方法,显然css方法更省事,尤其在不用兼容ie6的现在。哈哈
.alertMessageBg{
position:fixed;
_position:absolute;
width:100%;
height:100%;
left:0;
top:0;
background:#000;
opacity:0.5;
-moz-opacity:0.5;
filter:alpha(opacity=50);
z-index:97;
display:none;
}
.alertMessageDivBorder{
position:fixed;
_position:absolute;
width:750px;
height:370px;
left:50%;
top:50%;
margin:-185px 0 0 -375px;
background:#000;
filter:alpha(opacity=30);
-moz-opacity:0.3;
opacity:0.3;
z-index:98;
display:none;
}
.alertMessageDiv{
position:fixed;
_position:absolute;
width:730px;
height:350px;
left:50%;
top:50%;
margin:-175px 0 0 -365px;
background:#fff;
z-index:99;
display:none;
font-size:14px;
}
<div class="alertMessageBg"></div>
<div class="alertMessageDivBorder"></div>
<div class="alertMessageDiv"></div>
弹出层背景覆盖整个网页的方法
1.最近突然想起用的css方法
.alertMessageBg{
position:fixed;
_position:absolute;
width:100%;
height:100%;
left:0;
top:0;
background:#000;
opacity:0.5;
-moz-opacity:0.5;
filter:alpha(opacity=50);
z-index:97;
display:none;
}
2.js方法
.alertMessageBg{
position:absolute;
width:100%;
height:100%;
left:0;
top:0;
background:#000;
opacity:0.5;
-moz-opacity:0.5;
filter:alpha(opacity=50);
z-index:97;
display:none;
}
var bgWidth = document.body.clientWidth + 'px',
bgHeight = document.body.clientHeight + 'px',
alertBgNode = $('.alertMessageBg');
alertBgNode.css({'width':bgWidth,'height':bgHeight});
对比以上两种方法,显然css方法更省事,尤其在不用兼容ie6的现在。哈哈
相关文章推荐
- js与css实现弹出层覆盖整个页面的方法
- js与css实现弹出层覆盖整个页面的方法
- 逻辑思路实现弹出框背景颜色覆盖整个页面小细节
- 弹出透明层,覆盖整个浏览器,页面元素的相对可视范围的不动
- Bootstrap的模态框遮罩在iframe子页面弹出时不能覆盖父页面的解决方法
- JavaScript页面刷新与弹出窗口问题解决方法
- 文件下载时,只弹出下载框,不在页面打开的方法。
- 把整个Asp.net页面都转化为html代码的方法
- JavaScript页面刷新与弹出窗口问题解决方法
- 非常漂亮的让背景如此暗淡(一种弹出提示信息时页面背景色调改变的方法)
- JavaScript页面刷新与弹出窗口问题解决方法
- javascript实现页面弹出对话框,点确定再跳转到其他页面的方法
- 非常漂亮的让背景如此暗淡(一种弹出提示信息时页面背景色调改变的方法)
- 关于在后台调用Response.Writer();弹出框后页面css变化的解决方法
- 一种弹出提示信息时页面背景色调改变的方法
- 弹出页面的方法
- javascript页面刷新与弹出窗口问题解决方法
- PK几种弹出页面居中的方法
- 采用javascript向弹出页面中传递参数,用服务端代码取出的方法
- 让背景如此暗淡(一种弹出提示信息时页面背景色调改变的方法)