-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path68.client.html
52 lines (46 loc) · 1.37 KB
/
68.client.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<!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>
.rect {
position: relative;
width: 800px;
height: 600px;
background-color: rgb(248, 232, 232);
border: 1px solid black;
}
.ball {
position: absolute;
width: 150px;
height: 150px;
border-radius: 50%;
background-color: rgb(245, 216, 52);
text-align: center;
border: 1px solid black;
left: 100px;
top: 100px;
}
</style>
</head>
<body>
<div class="rect">
<div class="ball"></div>
</div>
<div id="info"></div>
<script>
const rect = document.querySelector(".rect");
const ball = document.querySelector(".ball");
const info = document.querySelector("#info");
rect.addEventListener("mousemove", function (event) {
info.innerText = `
client: ${event.clientX}, ${event.clientY},
page: ${event.pageX}, ${event.pageY},
offset: ${event.offsetX}, ${event.offsetY}`;
});
</script>
</body>
</html>