-
Notifications
You must be signed in to change notification settings - Fork 157
/
touch.html
172 lines (162 loc) · 3.76 KB
/
touch.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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
<!DOCTYPE HTML>
<html lang="en-US" style="height:100%">
<head>
<meta charset="UTF-8">
<title></title>
<meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport">
<style type="text/css">
body{
margin:0px;
padding:0px;
background :#000;
font-family:'microsoft yahei'
}
.consoleCnt{
position:absolute;
top: 0px;
left: 0px;
right: 0px;
bottom:60px;
overflow:auto;
}
.console{
position:relative;
width:33.33%;
float:left;
top:0px;
left:0px;
padding: 0px 0px 100px;
overflow: auto;
line-height:24px;
text-align:center;
font-size:13px;
color:#fff
}
.console3{background:#333;min-height:1000px;}
#toucher{
position:fixed;
bottom:0px;
left:0px;
width:100%;
height:60px;
background:#fff;
}
.checkA,.checkB,.checkC{
width : 33.33%;
height : 60px;
line-height : 60px;
text-align: center;
font-size:14px;
background: #fff;
float: left
}
.checkC{
background:#eee
}
</style>
</head>
<body>
<div class="consoleCnt">
<div class="console console1">
--logger--<br/>
</div>
<div class="console console3">
--logger--<br/>
</div>
<div class="console console2">
--logger--<br/>
</div>
</div>
<div id="toucher">
<div class="checkA">
<span>拖动</span>
</div>
<div class="checkC">
全部
</div>
<div class="checkB">
<span>手势</span>
</div>
</div>
<script type="text/javascript" src="http://lib.sinaapp.com/js/jquery/1.7.2/jquery.min.js"></script>
<script type="text/javascript" src="asset/toucher.js"></script>
<script type="text/javascript">
var i = 0;
function I(){
i++;
if(i>=100){
i=1;
}
return '-' + i;
}
var bodyTouch = util.toucher($('#toucher')[0]);
bodyTouch.on('singleTap',function(e){
$('.console3').append('singleTap'+I()+'<br/>');
}).on('doubleTap',function(e){
$('.console3').append('doubleTap'+I()+'<br/>');
}).on('longTap',function(e){
$('.console3').append('longTap'+I()+'<br/>');
}).on('swipeStart',function(e){
$('.console3').append('swipeStart'+I()+'<br/>');
//console.log(this,e);
}).on('swipe',function(e){
$('.console3').append('swipe'+I()+'<br/>');
//console.log(this,e);
}).on('swipeEnd',function(e){
$('.console3').append('swipeEnd'+I()+'<br/>');
//console.log(this,e);
}).on('swipeUp',function(e){
$('.console3').append('swipeUp'+I()+'<br/>');
}).on('swipeRight',function(e){
$('.console3').append('swipeRight'+I()+'<br/>');
}).on('swipeDown',function(e){
$('.console3').append('swipeDown'+I()+'<br/>');
}).on('swipeLeft',function(e){
$('.console3').append('swipeLeft'+I()+'<br/>');
});
bodyTouch.on('swipeStart','.checkA',function(e){
$('.console1').append('swipeStart<br/>');
$(this).css({
'position':'relative',
'background':'#ddd'
});
}).on('swipe','.checkA',function(e){
$('.console1').append('swipe-'+e.pageX +'<br/>');
// console.log(this,e);
$(this).css({
'top':e.moveY,
'left':e.moveX
});
return false;
}).on('swipeEnd','.checkA',function(e){
$('.console1').append('swipeEnd<br/>');
// console.log(this,e);
$(this).animate({
'position':'static',
'top':0,
'left':0,
'background':'#fff'
},100);
$(this).css('background','#fff');
});
bodyTouch.on('singleTap','.checkB',function(e){
$('.console2').append('singleTap'+I()+'<br/>');
}).on('doubleTap','.checkB',function(e){
$('.console2').append('doubleTap'+I()+'<br/>');
}).on('longTap','.checkB',function(e){
$('.console2').append('longTap'+I()+'<br/>');
}).on('swipeUp','.checkB',function(e){
$('.console2').append('swipeUp'+I()+'<br/>');
}).on('swipeRight','.checkB',function(e){
$('.console2').append('swipeRight'+I()+'<br/>');
}).on('swipeDown','.checkB',function(e){
$('.console2').append('swipeDown'+I()+'<br/>');
}).on('swipeLeft','.checkB',function(e){
$('.console2').append('swipeLeft'+I()+'<br/>');
});
$('.consoleCnt').click(function(){
$('.console').html('--logger--<br/>');
});
</script>
</body>
</html>