js如何实现点击拖拽功能?
话不多说直接上代码,代码如下:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<style type="text/css">
* {
margin: 0;
padding: 0;
}
.b {
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.5);
position: absolute;
top: 0;
left: 0;
display: none;
}
.c {
width: 300px;
height: 300px;
display: flex;
flex-direction: column;
background-color: white;
padding: 20px;
position: fixed;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
}
p:nth-of-type(1) {
display: flex;
width: 100%;
}
.l {
cursor: move;
}
tr{
background-color: #0099CC;