How JavaScript implements animations to open semitransparent hint layers

Source: Internet
Author: User
Tags setinterval

This article mainly introduced the JavaScript implementation animation to open the translucent hint layer method, involves the JavaScript operation DOM the related skill, very has the practical value, needs the friend to be possible to refer to under

This article illustrates how JavaScript implements animations to open semitransparent hint layers. Share to everyone for your reference. Specifically as follows:

?

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26-27--28 29---30 31--32 33 34 35 36 37 38-39 40 41 42 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 5, 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 11 9 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148-149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179-18 0 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209-210 211 212 <! 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-type "content=" text/html; charset=gb2312 "/> <title>dom semitransparent hint layer </title> <style type=" Text/css "> Body,span,div,td{font-size : 12px;line-height:1.5em;color: #849BCA;} #bodyL {float:left; width:84px; margin-right:2px;} a.od{width:80px; height:25px; line-height:25px; text-align:center; Font-weight:bold; border:2px solid #849BCA; Display:block; Color: #547BC9; Float:left; Text-decoration:none; margin-top:2px; a.od:link{background: #EEF1F8;} a.od:visited{background: #EEF1F8;} a.od:hover{background: #EEE;} a.od:active{backgr Ound: #EEE; } #fd {width:500px height:200px; background: #EDF1F8; border:2px solid #849BCA; margin-top:2px; margin-left:2px Eft Overflow:hidden; Position:absolute; left:0px; top:0px; Cursor:move; Float:left; }. content{Padding:10px; } </style> </head> <body> <div id= "Bodyl" > <a href= "#" class= "od" onclick = "Show (' fd '); false; " > [Open layer] </a> <a href= "#" class= "od" onclick = "closeed (' fd '); return false;" > [closed layer] </a> </div> <div id= "FD" style= "Display:none;filter:alpha (opacity=100); opacity:1;" > <div class= "Content" > Mobile layer </div> </div> <script type= "Text/javascript" > var ProX; var Proy; var Proxc; var Proyc; function Show (ID) {/*--open--*/clearinterval (ProX); clearinterval (Proy); clearinterval (PROXC); clearinterval (PROYC); var o = document.getElementById (ID); O.style.display = "block"; O.style.width = "1px"; O.style.height = "1px"; ProX = setinterval (function () {OpenX (o,500)},10); function OpenX (o,x) {/*--open x--*/var cx = parseint (o.style.width); if (CX < x) {O.style.width = (cx + math.ceil ((X-CX) /5) + "px"; else {clearinterval (prox); Proy = SetInterval (function () {Openy (o,200)},10);} function Openy (o,y) {/*--Open y--*/var cy = parseint (o.style.height); if (Cy < y) {O.style.height = (cy + math.ceil ((y-cy)/5)) + "px";} else {clearinterval (Proy);}} function Closeed (ID) {/*--close--*/clearinterval (ProX); clearinterval (Proy); clearinterval (PROXC); Clearinterval (Proyc ); var o = document.getElementById (ID); if (O.style.display = = "Block") {Proyc = SetInterval (function () {Closey (o)},10);} function Closey (o) {/*--open y--*/var cy = parseint (o.style.height); if (cy > 0) {o.style.height = (Cy-math.ceil (CY/5)) + "px"; else {clearinterval (PROYC); proxc = SetInterval (function () {closex (o)},10);} function Closex (o) {/*--open x--*/var cx = parseint (o.style.width); if (cx > 0) {o.style.width = (Cx-math.ceil (CX/5)) + " PX "; else {clearinterval (PROXC); o.style.display = ' None ';}} * * Mouse drag/var od = document.getElementById ("FD"); var dx,dy,mx,my,moused; var Odrag; var Isie = document.all? True:false; Document.onmousedown = function (e) {var e = e. e:event; if (E.button = = (document.all? 1:0)) {moUseD = true; } document.onmouseup = function () {moused = false; Odrag = ""; if (Isie) {od.releasecapture (); od.filters.alpha.opacity = +} else {window.releaseevents (od. MOUSEMOVE); od.style.opacity = 1; }//function Readymove (e) {od.onmousedown = function (e) {Odrag = this; var e = e. e:event; if (E.button = = (document.a ll? 1:0)) {mx = e.clientx; my = e.clienty; od.style.left = od.offsetleft + "px"; od.style.top = od.offsettop + "px"; if (IsI E) {od.setcapture (); od.filters.alpha.opacity =/else {window.captureevents (event.mousemove); od.style.opacity = 0. 5; }//alert (MX); alert (my); } Document.onmousemove = function (e) {var e = e. E:event//alert (MRX);//alert (E.button); if (Moused==true && Odrag) {var mrx = e.clientx-mx; var mry = e.clienty-my; od.style.left = parseint (od.style.left) +mrx + "px"; od.styl E.top = parseint (od.style.top) + Mry + "px"; mx = e.clientx; my = E.clienty; }} </script><br/> <div>http://www.jb51.net/</dIv> </body> </html>

The

wants this article to help you with your JavaScript programming.

Related Article

E-Commerce Solutions

Leverage the same tools powering the Alibaba Ecosystem

Learn more >

Apsara Conference 2019

The Rise of Data Intelligence, September 25th - 27th, Hangzhou, China

Learn more >

Alibaba Cloud Free Trial

Learn and experience the power of Alibaba Cloud with a free trial worth $300-1200 USD

Learn more >

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.