-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdemo.html
76 lines (75 loc) · 1.97 KB
/
demo.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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
<!DOCTYPE html>
<html lang="zh-cmn-Hans">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no">
<link rel="shortcut icon" href="" type="image/x-icon">
<meta content="telephone=no,email=no" name="format-detection">
<title>demo</title>
<style>
* {
padding: 0;
margin: 0;
}
.page {
width: 100%;
height: 50vh;
line-height: 50vh;
text-align: center;
}
</style>
</head>
<body>
<div class="page" id="event" style="background-color: greenyellow">
event 触摸滑动这里
</div>
<div class="page" id="es6" style="background-color: snow">
es6 触摸滑动这里
</div>
<script src="./touch-event.js"></script>
<script src="./touch-es6.js"></script>
<script>
// touch-es6
const esTouch = new Touch(document.querySelector('#es6'));
console.log(esTouch)
esTouch.on('throttle-move', (e) => {
console.log('throttle move', e);
})
esTouch.on('tap', (e) => {
console.log('es tap', e);
})
esTouch.on('press', (e) => {
console.log('press', e);
});
esTouch.on('swipe', (e) => {
console.log('es swipe', e);
})
esTouch.on('swipe-left', () => {
console.log('swipeLeft');
});
esTouch.on('swipe-right', () => {
console.log('swipeRight');
});
// touch-event
var myTouch = new touch('#event');
myTouch.on('throttle-move', (e) => {
console.log('throttle move', e);
});
myTouch.on('tap', function (e) {
console.log('tap', e);
});
myTouch.on('press', function (e) {
console.log('press', e);
});
myTouch.on('swipe', function () {
console.log('swipe');
});
myTouch.on('swipe-left', function () {
console.log('swipeLeft');
});
myTouch.on('swipe-right', function () {
console.log('swipeRight');
});
</script>
</body>
</html>