-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathpointerdown.html
More file actions
57 lines (53 loc) · 1.04 KB
/
Copy pathpointerdown.html
File metadata and controls
57 lines (53 loc) · 1.04 KB
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
53
54
55
56
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<style>
* {
touch-action: none;
touch-action: pinch-zoom;
}
#pane {
width: 400px;
height: 400px;
overflow: hidden;
position: relative;
}
#map {
background-color: green;
width: 150%;
height: 150%;
position: absolute;
top: -25%;
left: -25%;
z-index: 1;
}
#box {
background-color: red;
width: 40%;
height: 40%;
position: absolute;
top: 30%;
left: 30%;
z-index: 100;
}
</style>
<script>
function setup() {
// document.body.addEventListener('pointerdown', function (event) {
document.addEventListener('pointerdown', function (event) {
let target = event.target.id || event.target.nodeName;
console.log("target = " + target);
document.querySelector('pre').textContent = `target is ${target}`;
});
}
</script>
</head>
<body onload="setup()">
<div id="pane">
<div id="box"></div>
<div id="map"></div>
</div>
<pre>Tap the red box or green "map" to see the pointerevent target.</pre>
</body>
</html>