forked from Lochlan/simple-swipe
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
60 lines (58 loc) · 1.91 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
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, user-scalable=no">
<title>Swipe Example</title>
<style type="text/css">
html {
height: 100%;
}
body {
font-family: Helvetica, sans-serif;
font-size: 24px;
height: 100%;
margin: 0;
text-align: center;
}
#swipeBox {
box-sizing: border-box;
height: 100%;
padding-top: 60px;
}
</style>
<script type="text/javascript" src="simple-swipe.js"></script>
</head>
<body>
<div id="swipeBox">
<p>Swipe the page with one finger to change the background color</p>
<p>LEFT = ORANGE</p>
<p>RIGHT = GREEN</p>
<p>UP = MAROON</p>
<p>DOWN = PURPLE</p>
</div>
<script type="text/javascript">
var s = new SimpleSwipe(document.getElementById("swipeBox"),
undefined,
function (swipe, el) {
// Minimum swipe length
if (swipe.length < 72) {
return;
}
switch(swipe.direction) {
case 'left':
el.style.backgroundColor = 'orange';
break;
case 'right':
el.style.backgroundColor = 'green';
break;
case 'up':
el.style.backgroundColor = 'maroon';
break;
case 'down':
el.style.backgroundColor = 'purple';
}
});
</script>
</body>
</html>