Jquery实现遮罩层的简单实例(就是弹出DIV周围都灰色不能操作)
Jquery实现遮罩层的简单实例(就是弹出DIV周围都灰色不能操作)
<!DOCTYPEhtmlPUBLIC"-//W3C//DTDXHTML1.0Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <htmlxmlns="http://www.w3.org/1999/xhtml"> <head> <metahttp-equiv="Content-Type"content="text/html;charset=gb2312"/> <title>Jquery遮罩层</title> <styletype="text/css"> #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;} #DialogDiv{position:absolute;width:400px;left:50%;top:50%;margin-left:-200px;height:auto;z-index:100;background-color:#fff;border:1px#8FA4F5solid;padding:1px;} #DialogDivh2{height:25px;font-size:14px;background-color:#8FA4F5;position:relative;padding-left:10px;line-height:25px;} #DialogDivh2a{position:absolute;right:5px;font-size:12px;color:#000000} #DialogDiv.form{padding:10px;} #DialogDiv2{position:absolute;width:400px;left:50%;top:50%;margin-left:-200px;height:auto;z-index:100;background-color:#fff;border:1px#8FA4F5solid;padding:1px;} #DialogDiv2h2{height:25px;font-size:14px;background-color:#8FA4F5;position:relative;padding-left:10px;line-height:25px;} #DialogDiv2h2a{position:absolute;right:5px;font-size:12px;color:#000000} #DialogDiv2.form{padding:10px;} #DialogDiv3{position:absolute;width:400px;left:50%;top:50%;margin-left:-200px;height:auto;z-index:100;background-color:#fff;border:1px#8FA4F5solid;padding:1px;} #DialogDiv3h2{height:25px;font-size:14px;background-color:#8FA4F5;position:relative;padding-left:10px;line-height:25px;} #DialogDiv3h2a{position:absolute;right:5px;font-size:12px;color:#000000} #DialogDiv3.form{padding:10px;} </style> <scriptlanguage="javascript"type="text/javascript"src="jquery-1.4.2.min.js"></script> <scriptlanguage="javascript"type="text/javascript"> functionShowDIV(thisObjID){ $("#BgDiv").css({display:"block",height:$(document).height()}); varyscroll=document.documentElement.scrollTop; $("#"+thisObjID).css("top","100px"); $("#"+thisObjID).css("display","block"); document.documentElement.scrollTop=0; } functioncloseDiv(thisObjID){ $("#BgDiv").css("display","none"); $("#"+thisObjID).css("display","none"); } </script> </head> <body> <divid="BgDiv"></div> <!--遮罩层显示的DIV1--> <divid="DialogDiv"style="display:none"> <h2>弹出层<ahref="#"id="btnClose"onclick="closeDiv('DialogDiv')">关闭</a></h2> <divclass="form">我是弹出对话框111111!!</div> </div> <!--遮罩层显示的DIV2--> <divid="DialogDiv2"style="display:none"> <h2>弹出层<ahref="#"id="btnClose2"onclick="closeDiv('DialogDiv2')">关闭</a></h2> <divclass="form">我是弹出对话框2222!!</div> </div> <!--遮罩层显示的DIV3--> <divid="DialogDiv3"style="display:none"> <h2>弹出层<ahref="#"id="btnClose3"onclick="closeDiv('DialogDiv3')">关闭</a></h2> <divclass="form">我是弹出对话框3333333!!</div> </div>
以上这篇Jquery实现遮罩层的简单实例(就是弹出DIV周围都灰色不能操作)就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持毛票票。