forked from madrobby/zepto
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtouchcancel_functional.html
59 lines (52 loc) · 1.51 KB
/
touchcancel_functional.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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Zepto touch functional test</title>
<meta name="viewport" content="maximum-scale=1,initial-scale=1,user-scalable=0">
<script src="../src/polyfill.js"></script>
<script src="../src/zepto.js"></script>
<script src="../src/event.js"></script>
<script src="../src/touch.js"></script>
</head>
<body>
<h1>Zepto touch functional test</h1>
<p>
Double-tap and hold until the JavaScript alert occurs. After closing the
alert, tap again. Without touchcancel you will see a double tap instead of a tap.
</p>
<div id="touch_test" style="width: 200px; height: 200px; background: #ddd">
touch events test
</div>
<div id="browser"> </div>
<script>
$('#browser').text(navigator.userAgent)
setTimeout(function(){
alert("Alert! Now tap again, you should see a tap!, not a double tap!")
}, 3000)
$('body').bind('touchmove', function(e){ e.preventDefault() })
$('#touch_test')
.tap(function(){
$(this).append(' | tap!')
})
.doubleTap(function(){
$(this).append(' | double tap!')
})
.swipe(function(){
$(this).append(' | swipe!')
})
.swipeLeft(function(){
$(this).append(' | swipe left!')
})
.swipeRight(function(){
$(this).append(' | swipe right!')
})
.swipeUp(function(){
$(this).append(' | swipe up!')
})
.swipeDown(function(){
$(this).append(' | swipe down!')
})
</script>
</body>
</html>