请使用jQuery实现层的拖动效果。
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>div拖动</title>
<style>
div{
width: 200px;
height: 200px;
background: blue;
position: absolute;
}
</style>
</head>
<body>
<div></div>
</body>
<script src="../js/jquery-3.4.1.js"></script>
<script type="text/javascript">
var x,y;
var isDrag=false;
$("div").mousedown(function(){
isDrag=true;/
y=event.pageY-$(this).offset().top;
x=event.pageX-$(this).offset().left;
}).mousemove(function(){
if(isDrag){
$(this).css("top",event.pageY-y).css("left",event.pageX-x);
}
}).mouseup(function(){
isDrag=false;
});
</script>
</html>