jquery实现div遮罩层

 1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 2 <html xmlns="http://www.w3.org/1999/xhtml">
 3  <head>
 4   <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
 5   <title>Jquery遮罩层</title>
 6
 7   <style type="text/css">
 8       #BgDiv{background-color:#e3e3e3; position:absolute; z-index:99; left:0; top:0; display:none; width:100%; height:1000px;opacity:0.5;filter: alpha(opacity=50);-moz-opacity: 0.5;}
 9
10       #DialogDiv{position:absolute;width:400px; left:50%; top:50%; margin-left:-200px; height:auto; z-index:100;background-color:#fff; border:1px #8FA4F5 solid; padding:1px;}
11       #DialogDiv h2{ height:25px; font-size:14px; background-color:#8FA4F5; position:relative; padding-left:10px; line-height:25px;}
12       #DialogDiv h2 a{position:absolute; right:5px; font-size:12px; color:#000000}
13       #DialogDiv .form{padding:10px;}
14
15       #DialogDiv2{position:absolute;width:400px; left:50%; top:50%; margin-left:-200px; height:auto; z-index:100;background-color:#fff; border:1px #8FA4F5 solid; padding:1px;}
16       #DialogDiv2 h2{ height:25px; font-size:14px; background-color:#8FA4F5; position:relative; padding-left:10px; line-height:25px;}
17       #DialogDiv2 h2 a{position:absolute; right:5px; font-size:12px; color:#000000}
18       #DialogDiv2 .form{padding:10px;}
19
20       #DialogDiv3{position:absolute;width:400px; left:50%; top:50%; margin-left:-200px; height:auto; z-index:100;background-color:#fff; border:1px #8FA4F5 solid; padding:1px;}
21       #DialogDiv3 h2{ height:25px; font-size:14px; background-color:#8FA4F5; position:relative; padding-left:10px; line-height:25px;}
22       #DialogDiv3 h2 a{position:absolute; right:5px; font-size:12px; color:#000000}
23       #DialogDiv3 .form{padding:10px;}
24   </style>
25
26   <script language="javascript" type="text/javascript" src="../js/jquery-1.8.3.js"></script>
27   <script language="javascript" type="text/javascript">
28    function ShowDIV(thisObjID) {
29           $("#BgDiv").css({ display: "block", height: $(document).height() });
30           var yscroll = document.documentElement.scrollTop;
31           $("#" + thisObjID ).css("top", "100px");
32           $("#" + thisObjID ).css("display", "block");
33     document.documentElement.scrollTop = 0;
34       }
35
36       function closeDiv(thisObjID) {
37           $("#BgDiv").css("display", "none");
38           $("#" + thisObjID).css("display", "none");
39       }
40  </script>
41
42  </head>
43
44  <body>
45   <div id="BgDiv"></div>
46
47   <!--遮罩层显示的DIV1-->
48   <div id="DialogDiv" style="display:none">
49     <h2>弹出层<a href="#" id="btnClose" onclick="closeDiv(‘DialogDiv‘)">关闭</a></h2>
50    <div class="form">我是弹出对话框111111!!</div>
51   </div>
52
53   <!--遮罩层显示的DIV2-->
54   <div id="DialogDiv2" style="display:none">
55     <h2>弹出层<a href="#" id="btnClose2" onclick="closeDiv(‘DialogDiv2‘)">关闭</a></h2>
56    <div class="form">我是弹出对话框2222!!</div>
57   </div>
58
59   <!--遮罩层显示的DIV3-->
60   <div id="DialogDiv3" style="display:none">
61     <h2>弹出层<a href="#" id="btnClose3" onclick="closeDiv(‘DialogDiv3‘)">关闭</a></h2>
62    <div class="form">我是弹出对话框3333333!!</div>
63   </div>
64
65   <p>
66    <input value="弹出遮罩层1" type="button" id="btnShow1" onclick="ShowDIV(‘DialogDiv‘)" />
67    <input value="弹出遮罩层2" type="button" id="btnShow2"  onclick="ShowDIV(‘DialogDiv2‘)" />
68    <input value="弹出遮罩层3" type="button" id="btnShow3"  onclick="ShowDIV(‘DialogDiv3‘)" />
69   </p>
70  </body>
71 </html>
时间: 2024-09-27 04:29:27

jquery实现div遮罩层的相关文章

div 遮罩层 弹窗

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-

jQuery弹出遮罩层效果完整示例

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-

JS+CSS简单实现DIV遮罩层显示隐藏【转藏】

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head> <title>DIV CSS遮罩层</title

Jquery超简单遮罩层实现代码

看了很多代码,下面跟大家分享一下我认为最简单的遮罩层实现方式: 1.样式如下设置: CSS代码: [html] view plain copy print? <style type="text/css"> .mask { position: absolute; top: 0px; filter: alpha(opacity=60); background-color: #777; z-index: 1002; left: 0px; opacity:0.5; -moz-opa

在iframe内页面完全加载完后,关闭父页面生成的div遮罩层

遮罩层div为iframe父页面生成,需在iframe内页面完全加载完后,关闭遮罩层 alertMsgClose() :函数为关闭遮罩层函数 此段代码在iframe页面内: <script> $(function () { window.parent.alertMsgClose();// iframe 外层页面关闭遮罩层 }); </script> 原文地址:https://www.cnblogs.com/tmdsleep/p/10984450.html

DIV遮罩层传值

今天费了很大的劲儿才搞定!下面贴出代码和总结: 1.首先是前台代码: <%@ Page Title="" Language="C#" MasterPageFile="~/Main.Master" AutoEventWireup="true" CodeBehind="CategoryList.aspx.cs" Inherits="Bridgetree.Admin.CategoryList&qu

Jquery实现遮罩层,就是弹出DIV周围都灰色不能操作

<%@ page language="java" pageEncoding="UTF-8"%> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3

jQuery制作div板块拖动层排序

html结构: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="

前端小结(3)---- 添加遮罩层,并弹出div

有如下div: <div id='pop-div' class="pop-box"> <div class="input-group has-info"> <input class="form-control" id="bankCode" type="text" placeholder="请输入银行卡号" /> <span class="