-
Notifications
You must be signed in to change notification settings - Fork 175
/
index.html
82 lines (75 loc) · 2.57 KB
/
index.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
77
78
79
80
81
82
<!doctype>
<html>
<head>
<title>swiped-events demo</title>
<meta name="viewport" content="width=device-width,height=device-height,user-scalable=no,initial-scale=1,maximum-scale=1" />
<script src="src/swiped-events.js"></script>
<style>
body { overflow: hidden; }
div {
position: fixed;
left: 0;
right: 0;
margin: 0;
padding: 0;
overflow: hidden;
font-size: 40px;
font-family: arial;
display: flex;
align-items: center;
justify-content: center;
}
div:first-child {
top: 0px;
bottom: 50%;
background: #191919;
color: #eee;
}
div:last-child {
top: 50%;
bottom: 0;
background: #eee;
color: #191919;
}
</style>
<script>
window.onload = function() {
document.addEventListener('swiped', function(e) {
console.log(e.type);
console.log(e.target);
console.log(e.detail);
console.log(e.dir);
e.target.innerHTML = e.type;
});
document.addEventListener('swiped-left', function(e) {
console.log(e.type);
console.log(e.target);
console.log(e.detail);
e.target.innerHTML = e.type;
});
document.addEventListener('swiped-right', function(e) {
console.log(e.type);
console.log(e.target);
console.log(e.detail);
e.target.innerHTML = e.type;
});
document.addEventListener('swiped-up', function(e) {
console.log(e.type);
console.log(e.target);
console.log(e.detail);
e.target.innerHTML = e.type;
});
document.addEventListener('swiped-down', function(e) {
console.log(e.type);
console.log(e.target);
console.log(e.detail);
e.target.innerHTML = e.type;
});
}
</script>
</head>
<body data-swipe-threshold="100">
<div>Swipe me</div>
<div>or me</div>
</body>
</html>