<!DOCTYPE html>
<html> <head lang="en">
<meta charset="UTF-8">
<title></title>
<style>
.login-header {
width: 100%;
text-align: center;
height: 30px;
font-size: 24px;
line-height: 30px;
} ul,
li,
ol,
dl,
dt,
dd,
div,
p,
span,
h1,
h2,
h3,
h4,
h5,
h6,
a {
padding: 0px;
margin: 0px;
} .login {
display: none;
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: 14px;
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 solid 1px;
width: 40px;
height: 40px;
border-radius: 20px;
} </style>
</head> <body>
<div class="login-header"><a id="link" href="javascript:;">点击,弹出登录框</a></div>
<div id="login" class="login">
<div id="title" class="login-title">登录会员
<span><a id="closeBtn" href="javascript:void(0);" class="close-login">关闭</a></span>
</div>
<div class="login-input-content">
<div class="login-input">
<label>用户名:</label>
<input type="text" placeholder="请输入用户名" name="info[username]" id="username" class="list-input">
</div>
<div class="login-input">
<label>登录密码:</label>
<input type="password" placeholder="请输入登录密码" 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">登录会员</a></div>
</div>
<!-- 遮盖层 -->
<div id="bg" class="login-bg"></div> <script>
//获取动态元素
var login_header= document.querySelector('.login-header');
var login = document.querySelector('.login')
var login_bg = document.querySelector('#bg')
var login_close = document.querySelector('#closeBtn')
var login_title = document.querySelector('#title') //点击获取登录页面
login_header.addEventListener('click',function(){
login.style.display= 'block';
login_bg.style.display = 'block';
})
//点击关闭登录页面
login_close.addEventListener('click',function(){
login.style.display= 'none';
login_bg.style.display = 'none';
}) login_title.addEventListener('mousedown',function(e){
//鼠标在盒子内部的坐标
var x = e.pageX - login.offsetLeft;
var y = e.pageY - login.offsetTop;
//动态获取盒子的坐标
document.addEventListener('mousemove',move) function move(e){
login.style.left = e.pageX - x + 'px';
login.style.top = e.pageY - y + 'px';
}
//移除鼠标移动触发效果
document.addEventListener('mouseup',function(){
document.removeEventListener('mousemove',move)
})
})
</script>
</body> </html>

最新文章

  1. 如何在Notepad++ 中成功地安装Emmet 插件
  2. Java多态:upcast和downcast
  3. python 随笔(property &amp; __class__)
  4. DEDECMS里面DEDE函数解析
  5. Server Develop (八) IOCP模型
  6. javaWeb中servlet开发——过滤器
  7. skill-如何禁止浏览器的默认行为
  8. jQuery实例-记住登录信息
  9. HDU 5952 Counting Cliques 【DFS+剪枝】 (2016ACM/ICPC亚洲区沈阳站)
  10. linkin大话数据结构--Collections类
  11. HI3531ARM调试printf的实现
  12. 并发concurrent---1
  13. axios 拦截器统一在接口增加时间戳参数,防止走缓存。
  14. DOS批处理:FOR中的Delims和Tokens参数
  15. 滚动锚定(Scroll Anchoring)- 让视口内容不再因视口上方 DOM 元素的高度变化而产生跳动
  16. day 10 - 1 函数进阶
  17. A1039. Course List for Student
  18. easyui-combox(tagbox) 多选操作 显示为tagbox
  19. 【转】将项目打成war包并用tomcat部署的方法,步骤及注意点
  20. 克隆虚拟机重启之后eth0不见的解决方案

热门文章

  1. 【面试】【Linux】【Web】基础概念
  2. MicroK8S 安装 修改IP 设置镜像加速 升级 卸载等
  3. 虚拟机+OS系统安装+Xshell
  4. 筛选Table.SelectRows-文本与数值(Power Query 之 M 语言)
  5. CF390A Inna and Alarm Clock 题解
  6. CF177A1/A2 Good Matrix Elements 题解
  7. Django ModelForm表单验证
  8. 使用JSONArray.fromObject转化list时,如果有集合属性,很容易出错,此刻把集合属性过滤掉便可
  9. FastJsonHttpMessageConverter请求中参数序列化问题排查
  10. C语言获取文件大小(字节)