效果如下:
具体代码如下:
<!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;
}
body,
html {
/* background-color: #000; */
background-color: #00799E;
}
</style>
</head>
<body>
</body>
<script>
window.addEventListener('mousedown', function (e) {
//执行函数,并传入鼠标位置
// clientX / ev.clientY 获取鼠标的位置,从事件触发的坐标 到