JavaScript shading layer Effect _javascript technique

Source: Internet
Author: User
Tags setinterval
Think about it, or send it. Although the object-oriented is not very clear.
<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd "> <ptml xmlns=" http://www.w3.org/1999/xhtml "> <pead> <meta http-equiv=" Content-type "content=" text/html; Charset=utf-8 "/> <title></title> <style type=" Text/css "> * {padding:0; margin:0; list-style:none ; } html{height:100%;} Body {Font-family:verdana, Geneva, Sans-serif; font-size:14px;height:100%; line-height:26px;} #wrap {width:960px; margin:0 auto; height:auto;} #divId_no_click {position:absolute; display:none; top:0; left:0; width:100%; height:100%; Background-color: #555; z-ind ex:9999; Filter:alpha (opacity=10); opacity:0.3; } </style> </pead> <body> <div id= "wrap" >ok </div> <div id= "Divid_no_click" ></ div> <script type= "Text/javascript" > function $ (ID) {return document.getElementById (ID); var Class = {min_w:960, bint:function (r) {$(r). style.display = "block"; $ (R). Style.height =math.max (parseint (document.documentElement.scrollHeight), parseint ( Document.documentElement.offsetHeight) + "px"; $ (r). Style.width = Math.max (parseint (document.body.offsetWidth), class.min_w) + "px"; }, X:function (R,d) {for (i = 1; i < R i++) {var c = document.createelement ("div"); c.innerhtml = i; $ (d). AppendChild (c); }, Res:function (R,WR) {$ (R). Style.width = Math.max (parseint (document.body.offsetWidth), class.min_w) + "px"; $ (R). Style.height =math.max (parseint (document.documentElement.scrollHeight), parseint ( Document.documentElement.offsetHeight) + "px"; } }; $ ("OK"). onclick = function () {Class.bint ("Divid_no_click"); } window.onresize = function () {class.res ("Divid_no_click", "wrap"); } class.x ("Wrap"); </script> </body> </ptml>
[Ctrl + A All SELECT Note: If the need to introduce external JS need to refresh to perform]

You can also put the pop-up layer of the previous article in the production of the effect and this example to add a
<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd "> <ptml xmlns=" http://www.w3.org/1999/xhtml "> <pead> <meta http-equiv=" Content-type "content=" text/html; charset=gb2312 "/> <meta name=" Author "content=" Stri "/> <title></title> <style type=" Text/css "> * {padding:0; margin:0; List-style:none; } #a {width:380px; height:80px; border:5px solid #d3d3d3; Background-color: #f7f7f7; position:absolute; padding:10px ndex:999999; a.btn {display:block; width:80px cursor:pointer; Background-color: #f7f7f7; padding:2px 0px; border:1px solid #d5d5d5; Vertical-align:middle; Text-align:center; margin:50px Auto 5px; Text-decoration:none; } a:hover {background-color: #333; color: #fff; font-weight:bold;} HTML {height:100%;} Body {Font-family:verdana, Geneva, Sans-serif; font-size:14px; height:100%; line-height:26px;} #wrap {width:960px; margin:0 auto; Height:autO } #divId_no_click {position:absolute; display:none; top:0; left:0; width:100%; height:100%; Background-color: #555; z-i ndex:9999; Filter:alpha (opacity=10); opacity:0.3; } #aa {position:fixed; bottom:20px; right:10px;} </style> <script language= "javascript" type= "Text/javascript" > var drg=true; var ns= (document.all)? False:true; function Divcenter () {remove (); var c=document.createelement ("div"); Document.body.appendChild (c); C.setattribute ("id", "a"); C.setattribute ("Dragable", "dragable"); C.onmousedown=foo; var Divid=document.getelementbyid ("a"); divid.innerhtml+= "Code exception!<br> error number: 0015;"; divid.style.left= (document.documentelement.clientwidth-divid.clientwidth)/2+ document.documentelement.scrollleft+ "px"; settimeout (function () {divid.style.top= (document.documentelement.clientheight-divid.clientheight)/2+ document.documentelement.scrolltop-50+ "px";},100); H_w (300,80); }//Remove function remove () {if (documeNt.getelementbyid ("a")) {Document.body.removeChild ("a")) (document.getElementById ("a")); }} function foo () {if (DRG) {if (document.getElementById ("a")!=null) {Obj=do Cument.getelementbyid ("a"); Document.onmousedown=m_d; Document.onmouseup=m_u; } else {document.onmousemove=no_f; Document.onmousedown=no_f; Document.onmouseup=no_f; }} function M_d (e) {document.onmousemove=m_m; x= (NS)? E.pagex:event.x; y= (NS)? E.pagey:event.y; Cx=obj.offsetleft-x; Cy=obj.offsettop-y; } function M_m (e) {drg=false; x= (NS)? E.pagex:event.x; y= (NS)? E.pagey:event.y; Obj.style.left= (cx+x) + "px"; Obj.style.top= (cy+y) + "px"; function M_u () {drg=true; Document.onmousedown=no_f; Document.onmousemove=no_f; Document.onmouseup=no_f; } FUnction No_f () {return false;} function H_w (a,b) {Divid=document.getelementbyid ("a"); Divid.style.width= "0px"; divid.style.height= "0px"; var s=function () {var w=parseint (divId.style.width); if (w<a) {Divid.style.width=w+math.ceil (a-w)/20) + "px"; divid.style.left= (document.documentelement.clientwidth-divid.clientwidth)/2+ document.documentelement.scrollleft+ "px";} else {clearinterval (ST); divid.style.width=a+ "px";} var t=function () {var h=parseint (divId.style.height); if (h<b) {Divid.style.height=h+math.ceil (b-h)/10) + "px"; divid.style.top= (document.documentelement.clientheight-divid.clientheight)/2+ document.documentelement.scrolltop-10+ "px";} else {clearinterval (TT); divid.style.height=b+ "px";} } var st = Window.setinterval (s,1); var tt=window.setinterval (t,1); </script> </pead> <body> <div id= "Divid_no_click" ></div> <div id= "wrap" > Submitted </ div> <script type= "Text/javascript" > function $ (ID) {return document.getElementById (ID); The var Class = {min_w:960, bint:function (r) {$ (R). style.display = "block"; $ (R). Style.height =math.max (parseint (document.documentElement.scrollHeight), parseint ( Document.documentElement.offsetHeight) + "px"; $ (r). Style.width = Math.max (parseint (document.body.offsetWidth), class.min_w) + "px"; }, X:function (R,d) {for (i = 1; i < R i++) {var c = document.createelement ("div"); c.innerhtml = i; $ (d). AppendChild (c); }, Res:function (R,WR) {$ (R). Style.width = Math.max (parseint (document.body.offsetWidth), class.min_w) + "px"; $ (R). Style.height =math.max (parseint (document.documentElement.scrollHeight), parseint ( Document.documentElement.offsetHeight) + "px"; } }; $ ("AA"). onclick = function () {Divcenter (); Class.bint ("Divid_no_click"); } window.onresize = function () {class.res ("Divid_no_click", "wrap"); } class.x (M, "wrap"); </script> </body> </ptml>
[Ctrl + A All SELECT Note: If the need to introduce external JS need to refresh to perform]

Main code:
Copy Code code as follows:

var class = {
min_w:960,
Bint:function (r) {
$ (r). STYLE.DISPL ay = "block";
$ (R). Style.height =math.max (parseint (document.documentElement.scrollHeight), parseint ( Document.documentElement.offsetHeight) + "px";
$ (r). Style.width = Math.max (parseint (document.body.offsetWidth), class.min_w) + "px";
},
X:function (r,d) {
for (i = 1; i < R i++) {
var c = document.createelement ("div");
c.innerhtml = i;
$ (d). AppendChild (c);
}
},
Res:function (R,WR) {
$ (r). Style.width = Math.max (parseint (document.body.offsetWidth), class.min _W) + "px";
$ (R). Style.height =math.max (parseint (document.documentElement.scrollHeight), parseint ( Document.documentElement.offsetHeight) + "px";
}
};
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.