当前位置:网站首页>Drag modal box
Drag modal box
2022-06-25 05:03:00 【Dai Sensen】
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style> * {
margin: 0; padding: 0; } .login_bg {
display: none; position: absolute; width: 100%; height: 100%; background-color: rgba(0, 0, 0, 0.6); z-index: 1; } h1 {
text-align: center; } .login_box {
display: none; position: fixed; top: 50%; left: 50%; transform: translateX(-50%) translateY(-50%); text-align: center; width: 400px; height: 200px; background-color: pink; z-index: 2; } </style>
</head>
<body>
<div id='bg' class="login_bg"></div>
<h1> Click to pop up the login box </h1>
<div class="login_box">
<h3> Member login </h3>
<div> user name :<input type="text" value=" Please enter a user name "></div>
<div> password :<input type="password" value=" Please enter the login password "></div>
<button class="link"> Login member </button>
<button class="close"> close </button>
<script> var login_box = document.querySelector('.login_box'); var mask = document.querySelector('.login_bg'); var h1 = document.querySelector('h1'); var close = document.querySelector('.close'); var link = document.querySelector('.link'); var h3 = document.querySelector('h3'); h1.addEventListener('click', function() {
login_box.style.display = 'block'; mask.style.display = 'block'; }); close.addEventListener('click', function() {
login_box.style.display = 'none'; mask.style.display = 'none'; }); // Get the mouse coordinates in the box h3.addEventListener('mousedown', function(e) {
var x = e.pageX - login_box.offsetLeft; var y = e.pageY - login_box.offsetTop; // Coordinates from the border to the edge of the document document.addEventListener('mousemove', fn); function fn(e) {
login_box.style.left = e.pageX - x + 'px'; login_box.style.top = e.pageY - y + 'px'; } // Mouse movement event removal document.addEventListener('mouseup', function() {
document.removeEventListener('mousemove', fn); }); }); </script>
</div>
</body>
</html>
边栏推荐
- SRC platform summary
- Heavy broadcast | phase shift method + mathematical principle derivation of multi frequency heterodyne + implementation
- ThinkPHP 5 log management
- 执行SQL响应比较慢,你有哪些排查思路?
- olap分析引擎——Kylin4.0
- Basic knowledge of web pages (URL related)
- buuctf web
- 在 .NET 6 中使用 dotnet format 格式化代码
- WPF uses Maui's self drawing logic
- JDBC (IV)
猜你喜欢

Rce code execution & command execution (V)

两小时带你进入软件测试行业风口(附全套软件测试学习路线)

Chapter IX app project test (2) test tools

Customize the console plot result style

Specific operations for uploading pictures in PHP

渗透测试-目录遍历漏洞

为什么SQL语句命中索引比不命中索引要快?

What if the desktop computer is not connected to WiFi

dotnet-exec 0.4.0 released

Detailed summary of float
随机推荐
Mysql interactive_ Timeout and wait_ Timeout differences
固態硬盤開盤數據恢複的方法
《QDebug 2022年6月》
Calculate student grade (virtual function and polymorphism)
Flex flexible layout for mobile terminal page production
Web3 DAPP user experience best practices
以太网是什么要怎么连接电脑
基于SSH实现的学生成绩管理系统
In Net 6 using dotnet format formatting code
Cookie & session & JSP (XII)
XSS (cross site script attack) summary (II)
魔法猪系统重装大师怎么使用
"Daily practice, happy water" 1108 IP address invalidation
parallel recovery slave next change & parallel recovery push change
执行SQL响应比较慢,你有哪些排查思路?
融合CDN,为客户打造极致服务体验!
本轮压力测试下,DeFi协议们表现如何?
Why is the TCP handshake just 3 times?
Creation and use of MySQL index
February 20ctf record