<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
img{
width: 100px;
position:absolute;
top:0px;
left:0px;
}
</style>
</head>
<body>
<img src="https://ss3.bdstatic.com/70cFv8Sh_Q1YnxGkpoWK1HF6hhy/it/u=1839515912,3922605581&fm=26&gp=0.jpg" alt="你的小可爱爱" srcset="">
<script>
var imgposition=document.querySelector(‘img‘);
document.addEventListener(‘mousemove‘,function(e){
var ex=e.pageX;
var ey=e.pageY;
imgposition.style.left=ex-50+‘px‘;
imgposition.style.top=ey-50+‘px‘;
console.log(ex);
// imgposition.pageX=ex;
// imgposition.pageY=ey;
})
</script>
</body>
</html>