-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathstart-move-end.html
33 lines (33 loc) · 1.03 KB
/
start-move-end.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
<!DOCTYPE HTML>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0;" />
<title>HTML5测试</title>
</head>
<body >
<div style="height: 2000px;width: 100%;background: pink" id="divADBox">
</div>
<script type="text/javascript">
var startX, startY, endX, endY;
var showADID = 1;
document.getElementById("divADBox").addEventListener("touchstart", touchStart, false);
document.getElementById("divADBox").addEventListener("touchmove", touchMove, false);
document.getElementById("divADBox").addEventListener("touchend", touchEnd, false);
function touchStart(event) {
console.log("touchStart");
var touch = event.touches[0];
startY = touch.pageY;
startX = touch.pageX;
}
function touchMove(e) {
var touch = e.touches[0];
endX = touch.pageX;
console.log("touchMove "+ endX)
e.preventDefault();
}
function touchEnd(event) {
console.log("touchEnd");
}
</script>
</body>
</html>