<> Three events are required to move the entire element :

Mouse down onmousedown, Mouse movement onmousemove, Mouse up onmouseup

<div id="login" class="login"> <!-- click title Drag and drop --> <div id="title" class=
"login-title"> Login member <!-- title end --> <span><a id="closeBtn" href=
"javascript:void(0);" class="close-login"> close </a></span> </div> <div class=
"login-input-content"> <div class="login-input"> <label> user name :</label> <input type
="text" placeholder=" enter one user name " name="info[username]" id="username" class=
"list-input"> </div> <div class="login-input"> <label> Login password :</label> <input type=
"password" placeholder=" Please enter the login password " name="info[password]" id="password" class=
"list-input"> </div> </div> <div id="loginBtn" class="login-button"><a href=
"javascript:void(0);" id="login-button-submit"> Login member </a></div> </div>

var login = document.querySelector('.login');// Get the contents of the whole pop-up var title = document.
querySelector('#title'); title.addEventListener('mousedown',function(e){
// When you press the mouse , Get the mouse coordinates in the drag box // Mouse coordinates on the page - The distance from the large box to the left of the browser var x = e.pageX - login.
offsetLeft; var y = e.pageY - login.offsetTop; // Mouse movement document.addEventListener(
'mousemove',move); function move(e){ // Drag box positioning = Mouse coordinates on the page - The mouse is dragging the coordinates of the box login.style
.left = e.pageX - x + 'px'; login.style.top = e.pageY - y + 'px'; }
// When the mouse is up , Delete move event document.addEventListener('mouseup',function(){ document.
removeEventListener('mousemove',move); }) })
<>CSS part
<style> *{ padding: 0px; margin: 0px; } .login { display: block; width: 512px;
height: 280px; position: fixed; border: #ebebeb solid 1px; left: 50%; top: 50%;
background: #ffffff; box-shadow: 0px 0px 20px #ddd; z-index: 9999; transform:
translate(-50%, -50%); } .login-title { width: 100%; margin: 10px 0px 0px 0px;
text-align: center; line-height: 40px; height: 40px; font-size: 18px; position:
relative; cursor: move; } .login-input-content { margin-top: 20px; } .login-
button{ width: 50%; margin: 30px auto 0px auto; line-height: 40px; font-size: 14
px; border: #ebebeb 1px solid; text-align: center; } .login-bg { display: none;
width: 100%; height: 100%; position: fixed; top: 0px; left: 0px; background:
rgba(0, 0, 0, .3); } a { text-decoration: none; color: #000000; } .login-button
a{ display: block; } .login-input input.list-input { float: left; line-height:
35px; height: 35px; width: 350px; border: #ebebeb 1px solid; text-indent: 5px; }
.login-input { overflow: hidden; margin: 0px 0px 20px 0px; } .login-input label
{ float: left; width: 90px; padding-right: 10px; text-align: right; line-height:
35px; height: 35px; font-size: 14px; } .login-title span { position: absolute;
font-size: 12px; right: -20px; top: -30px; background: #ffffff; border: #ebebeb
solid1px; width: 40px; height: 40px; border-radius: 20px; } </style>

©2019-2020 Toolsou All rights reserved,
switch Statement programming : Give a percentage score , Output grade required A,B,C,D,E.Jetson Nano read GPS data (TTL turn USB)yolov3 Detailed explanation - model structure Android Mobile application foundation learning —— Chapter 1 basic introduction Four years of programming , Or is it inferior Database design AWS Elastic Load Balancing (Amazon ELB) Study notes el-select Parameter problem From outsourcing testing to Alibaba , A girl of three books C++STL Container summary