实现效果
1、点击登录按钮,模态框显示
2、点击关闭按钮,模态框隐藏
3、在指定可拖拽位置按下鼠标,模态框可跟随鼠标移动
4、松开鼠标,模态框停留在原地
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<style type="text/css">
*{
margin: 0;
padding: 0;
}
a{
text-decoration: none;
color:#000;
}
.login-header{
text-align: center;
font-size: 25px;
width: 400px;
height: 50px;
line-height: 50px;
margin: 10px auto;
border: #ccc 2px solid;
border-radius: 15px;
background-color:#ebebeb;
}
.login{
display: none;
width: 512px;
height: 280px;
position: fixed;
border: #ebebeb solid 1px;
border-radius: 10px;
left: 50%;
top: 50%;
background-color: #fff;
box-shadow: 0px 0px 20px #ddd;
z-index: 9999;
transform: translate(-50%,-50%);
}
.login-title{
text-align: center;
margin: 20px auto;
width: 100%;
height: 40px;
font-size: 20px;
font-weight: 600;
position: relative;
cursor: move;
}