jQuery弹出遮罩层效果完整示例
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"<head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>jQuery 遮罩层</title><style type="text/css">/* 半透明的遮罩层 */#overlay { background: #000; filter: alpha(opacity=50); /* IE的透明度 */ opacity: 0.5; /* 透明度 */ display: none; position: absolute; top: 0px; left: 0px; width: 100%; height: 100%; z-index: 100; /* 此处的图层要大于页面 */ display:none; _ padding: 0px 0px 0px 5px; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border-left: 3px solid rgb(108, 226, 108); line-height: 20px; width: 640px; clear: both; border-radius: 0px !important; border-top: 0px !important; border-right: 0px !important; border-bottom: 0px !important; border-image: initial !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; outline: 0px !important; overflow: visible !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; box-sizing: content-box !important; font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; min-height: auto !important; color: gray !important;">#a0a0a0; /* 解决IE6的不透明问题 */}</style><script type="text/javascript" src="jquery-1.7.2.min.js"></script><script type="text/javascript">/* 显示遮罩层 */function showOverlay() { $("#overlay").height(document.body.scrollHeight); $("#overlay").width(document.body.scrollWidth); // fadeTo第一个参数为速度,第二个为透明度 // 多重方式控制透明度,保证兼容性,但也带来修改麻烦的问题 $("#overlay").fadeTo(200, 0.5); // 解决窗口缩小时放大后不全屏遮罩的问题 // 简单来说,就是窗口重置的问题 $(window).resize(function(){ $("#overlay").height(document.body.scrollHeight); $("#overlay").width(document.body.scrollWidth); });}/* 隐藏覆盖层 */function hideOverlay() { $("#overlay").fadeOut(200);}</script></head><body><button onClick="showOverlay();" style=" width:100px; height:60px; margin:40px auto 40px auto; display:block;">打开遮罩层</button><button onClick="hideOverlay();" style=" width:100px; height:60px; z-index:101; display:block; position:absolute; left:10px; top:10px;">关闭遮罩层</button><div style="height:10000px;"></div><div id="overlay"></div></body></html>jQuery弹出遮罩层效果完整示例的更多相关文章
- jQuery实现打开网页自动弹出遮罩层或点击弹出遮罩层功能示例
本文实例讲述了jQuery实现打开网页自动弹出遮罩层或点击弹出遮罩层功能.分享给大家供大家参考,具体如下: 弹出层:两种方式 一是打开网页就自动弹出层二是点击弹出 <!DOCTYPE html ...
- jquery特效(7)—弹出遮罩层且内容居中
上周写了几个小特效,其中有个点击按钮弹出遮罩层的特效,下面来看最终实现的效果: 由于是测试的程序,所以我未加关闭的按钮. 一.主体程序 <!DOCTYPE html> <html&g ...
- 移动端和PC端弹出遮罩层后,页面禁止滚动的解决方法及探究
PC端解决方案 pc端的解决思路就是在弹出遮罩层的时候取消已经存在的滚动条,达到无法滚动的效果. 也就是说给body添加overflow:hidden属性即可,IE6.7下不会生效,需要给html增加 ...
- Css动画形式弹出遮罩层,内容区上下左右居中于不定宽高的容器中
<!DOCTYPE html> <html> <head> </head> <body id="body"> <! ...
- JQuery弹出层,点击按钮后弹出遮罩层,有关闭按钮
<!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <t ...
- JQuery弹出层,点击按钮后弹出遮罩层,有关闭按钮【转】
<!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <t ...
- JS 点击按钮后弹出遮罩层,有关闭按钮
<!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <t ...
- jQuery 弹出div层
目的:使用jQuery弹出一个div窗口:这种效果经常应用于页面内容的展示,登录效果的实现.其实,实现这种效果有好多种方式: 效果如下: 代码如下: <html> <head> ...
- HTML 弹出遮罩层二(遮罩层和内容标签分开)
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...
随机推荐
- [na]acl拒绝访问流量审计
acl审计拒绝的流量及拒绝提示 interface Ethernet0/0 ip address 12.1.1.2 255.255.255.0 ip access-group 10 in half-d ...
- Direct-X学习笔记--三维摄像机
一.介绍 哇! 到了传说中的3D摄像机啦! 之前我们写的东东,都是观察点不动,通过世界变换让东西动,今天,通过三维摄像机我们就能够改变我们的观察点,观察方向,任意在三维空间中驰骋.之前我们所设定的视角 ...
- nc 传输文件
在接收服务器上执行:(123.57.36.227) [root@ ~]# cat /tmp/user.txt hello world [root@ ~]# nc -v -l -p >/tmp/u ...
- android stuido - 关闭单词拼写检查
"File"-"Settings"-"Editor "-"Inspections" 在Spelling栏取消选中,再点击 ...
- 随笔记:如何使用Python连接(/操作)Oracle数据库(Windows平台下)
遇到需求,我们需要用Python对Oracle数据库进行操作. 这次我们使用cx_Oracle Oracle Client 在安装cx_Oracle之前,先安装Oracle客户端. cx_Oracle ...
- (基于Jenkins + SVN + Ant + Weblogic Server的)应用程序自动(/一键)部署的设想
一直想实现自动部署,这里说的自动部署,是指点击一个按钮(或定时执行),让计算机将最新的应用程序发布到相应的环境(UAT或PRD)中. 自动部署的意义 自动部署能省去繁琐的人工发布步骤:如配置得当,发布 ...
- JS 计算1到1000000个自然数中有几个1的自然数?
<script> window.onload=function(){ var arr=[]; for(var i=1;i<1000001;i++) { var stri= i.t ...
- win10无法使用内置管理员账户打开应用
win10无法使用内置管理员账户打开应用怎么办 听语音 | 浏览:42181 | 更新:2016-02-21 10:04 | 标签:WIN10 1 2 3 4 5 6 7 分步阅读 推荐视频 mo ...
- 未在本地计算机上注册"Microsoft.Jet.OLEDB.4.0"
答案一: 因为没有安装64位的Jet40驱动.可以到http://www.microsoft.com/downloads/zh-cn/details.aspx?FamilyID=c06b8369-60 ...
- 【Unity笔记】屏幕坐标和鼠标坐标
屏幕坐标:左下角为原点. void Update(){ // 获取物体的屏幕坐标,世界坐标->屏幕坐标 Vector3 screenPos = Camera.main.WorldToScreen ...