JS implementation Baidu login window drag effect


When we use Baidu-related function web pages, we have to log in to the account. But is the small friends have paid attention to the drag effect of Baidu’s login window? The source code of the imitation Baidu login drag effect

      #BOX {width: 200px; Height: 200px; Position: absolute; Left: 100px; Top: 100px; Background-Color: Red;}       VAR OBOX = Document.GtelementByid ("box") // mouse Press Event Obox.Onmousedown = Function (EV) {var EV = EV || Event var Difx = ev.clientX - Obox.Offsetleft VAR DIFY = ev.clienty - Obox.offSettop // Remove immediately to move the mouse obox.onmousemove = function (ev) {// The EV in the EV and onMousedown is different VAR EV = EV || Event var Obox_left = Ev.Clientx - Difx Var Obox_top = ev.clienty - DIFY OBOX.Style.LEFT = Obox_left + "PX" OBOX.Style.top = Obox_top+ "PX"} // Do not move Obox.onMouseUp = function () when the mouse is lifted, = null}} 

The above code is to imitate the implementation of the Baidu login window effect, and the small partners copy the code to the compiler to see the effect. I hope that the guys who have developed the front-end development help. The above is all the content of this article, I hope everyone supports TUMI clouds.

© Copyright Notice
Just support it if you like
comment Grab the couch

Please log in to comment