100字范文,内容丰富有趣,生活中的好帮手!
100字范文 > js与css实现弹出层覆盖整个页面办法【javascript】

js与css实现弹出层覆盖整个页面办法【javascript】

时间:2020-09-19 07:03:01

相关推荐

js与css实现弹出层覆盖整个页面办法【javascript】

web前端|js教程

js,css,弹出层,覆盖,整个页面

web前端-js教程

本文实例讲述了js与css实现弹出层覆盖整个页面的方法。分享给大家供大家参考。具体实现方法如下:

汽车贷款管理系统源码,vscode运行 目录,ubuntu开启远程登录,tomcat 使用war,sqlite数据裤,租服务器是什么意思,头像裁切插件,前端实时消息框架,中国商标网 爬虫,Php代驾,成都seo优化推广公司,蓝色扁平化网站,html5 动态网页,手机门户 模板,静态页面登陆,兴复人才网管理系统v8.8,php程序功能规则lzw

弹出层透明背景加框的常用样式和结构如下:

页游戏源码开源,vscode中安装rvm,独立显卡ubuntu,tomcat配置类型,sqlite查询修改数据,jq弹框插件,市面上的流行前端框架,抖音小店免费爬虫工具,php 类的静态方法,服装seo优化培训,服装商城网站源码,网页时间 html,制作网页模板下载lzw

.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;

}

串口调试助手 源码,VSCODE变暗,Ubuntu前端开发,tomcat日记,开源中国sqlite,江苏电信服务器托管,discuz头像插件,web前端vue框架,小的黑色爬虫,php编程培训学校,喵绅士SEO,阿里云网站模板 解析,电脑网页源码,ecshop模板韩都衣舍,jsp登录页面模板,学生成绩管理系统程序设计,modbus 485程序lzw

弹出层背景覆盖整个网页的方法

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的现在。

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。