-
Notifications
You must be signed in to change notification settings - Fork 3
/
index.html
232 lines (226 loc) · 11.4 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
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
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
<!DOCTYPE html>
<html>
<head>
<title>swiper-do-swipe.js</title>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0"/>
<link rel="stylesheet" type="text/css" href="static/swiper-do-swipe.css">
<link rel="stylesheet" type="text/css" href="screen.css">
</head>
<body>
<section style="background:white">
<h1>swiper-do-swipe.js <abbr title="version">v</abbr>0.6</h1>
<p>This software is for touch-screen web apps, and Phonegap-style apps, that want swiping and scrolling with 'pages' arranged like this</p>
<table border="1" class="device">
<tr>
<td class="here">Page1<br><small>you are here</small></td>
<td>Page2</td>
<td>Page3</td>
<td>Page4</td>
</tr>
</table>
<p>It supports Android, mobile Firefox, and iOS.</p>
<h2>Demo</h2>
<p>Swipe the page left or right, or up and down, with touch or mouse.</p>
<p>And choose a page effect if you want it <select id="effect">
<option value="flat">Flat</option>
<option value="perspective">Perspective</option>
</select></p>
<h2>Features</h2>
<ul>
<li>• it's fast (using requestAnimationFrame, fast click, reduced GPU texture size during swipe, and other optimisations)</li>
<li>• live animation feedback during swipe (not just a 'completed swipe' animation like jQuery Mobile <i>et al</i>)</li>
<li>• designed to be extensible with other swipe animations</li>
<li>• has callback for page turning that you can tie into your mobile app</li>
<li>• no dependencies</li>
</ul>
<p>Also it works around some significant Android bugs to do with scrolling and swiping (<a href="https://code.google.com/p/android/issues/detail?id=5491">1</a>, <a href="https://code.google.com/p/android/issues/detail?id=19827">2</a>).</p>
<h2>Usage</h2>
<pre>
var swiper = swiper_do_swipe(
$("section"),
swiper_do_swipe_effects.perspective
);
var callback = function(event, $page, index){
console.log(event, $page, index);
}
swiper.onchange(callback).oninit(callback);
</pre>
<h2>Source</h2>
<p>on <a href="http://github.com/holloway/swiper-do-swipe">Github</a></p>
<h2>Filler content</h2>
<ol>
<li>more content to show scrolling.</li>
<li>more content to show scrolling.</li>
<li>more content to show scrolling.</li>
<li>more content to show scrolling.</li>
<li>more content to show scrolling.</li>
<li>more content to show scrolling.</li>
<li>more content to show scrolling.</li>
<li>more content to show scrolling.</li>
<li><a href="javascript:alert('testing click events this is a href=javascript: one because no one does that anymore')">showing that click events still work.</a></li>
<li>more content to show scrolling.</li>
<li>more content to show scrolling.</li>
<li>more content to show scrolling.</li>
<li>more content to show scrolling.</li>
<li>more content to show scrolling.</li>
<li>more content to show scrolling.</li>
<li>more content to show scrolling.</li>
<li>more content to show scrolling.</li>
<li>more content to show scrolling.</li>
<li>more content to show scrolling.</li>
<li>more content to show scrolling.</li>
<li>more content to show scrolling.</li>
<li>more content to show scrolling.</li>
<li>more content to show scrolling.</li>
<li>more content to show scrolling.</li>
<li>more content to show scrolling.</li>
<li>more content to show scrolling.</li>
<li>more content to show scrolling.</li>
<li>more content to show scrolling.</li>
<li>more content to show scrolling.</li>
<li>more content to show scrolling.</li>
<li>more content to show scrolling.</li>
<li>more content to show scrolling.</li>
<li>more content to show scrolling.</li>
<li>more content to show scrolling.</li>
<li>more content to show scrolling.</li>
<li>more content to show scrolling.</li>
<li>more content to show scrolling.</li>
<li>more content to show scrolling.</li>
<li>more content to show scrolling.</li>
<li>more content to show scrolling.</li>
<li>more content to show scrolling.</li>
<li>more content to show scrolling.</li>
<li>more content to show scrolling.</li>
<li>more content to show scrolling.</li>
</ol>
</section>
<section style="background:#fef">
<h1>page 2</h1>
<table border="1" class="device">
<tr>
<td>Page1</td>
<td class="here">Page2<br><small>you are here</small></td>
<td>Page3</td>
<td>Page4</td>
</tr>
</table>
</section>
<section style="background:#eff">
<h1>section 3</h1>
<table border="1" class="device">
<tr>
<td>Page1</td>
<td>Page2</td>
<td class="here">Page3<br><small>you are here</small></td>
<td>Page4</td>
</tr>
</table>
</section>
<section style="background:white">
<h1>section 4</h1>
<table border="1" class="device">
<tr>
<td>Page1</td>
<td>Page2</td>
<td>Page3</td>
<td class="here">Page4<br><small>you are here</small></td>
</tr>
</table>
<p>you can't swipe further i won't let you!</p>
<ol>
<li>more content to show scrolling.</li>
<li>more content to show scrolling.</li>
<li>more content to show scrolling.</li>
<li>more content to show scrolling.</li>
<li>more content to show scrolling.</li>
<li>more content to show scrolling.</li>
<li>more content to show scrolling.</li>
<li>more content to show scrolling.</li>
<li>more content to show scrolling.</li>
<li>more content to show scrolling.</li>
<li>more content to show scrolling.</li>
<li>more content to show scrolling.</li>
<li>more content to show scrolling.</li>
<li>more content to show scrolling.</li>
<li>more content to show scrolling.</li>
<li>more content to show scrolling.</li>
<li>more content to show scrolling.</li>
<li>more content to show scrolling.</li>
<li>more content to show scrolling.</li>
<li>more content to show scrolling.</li>
<li>more content to show scrolling.</li>
<li>more content to show scrolling.</li>
<li>more content to show scrolling.</li>
<li>more content to show scrolling.</li>
<li>more content to show scrolling.</li>
<li>more content to show scrolling.</li>
<li>more content to show scrolling.</li>
<li>more content to show scrolling.</li>
<li>more content to show scrolling.</li>
<li>more content to show scrolling.</li>
<li>more content to show scrolling.</li>
<li>more content to show scrolling.</li>
<li>more content to show scrolling.</li>
<li>more content to show scrolling.</li>
<li>more content to show scrolling.</li>
<li>more content to show scrolling.</li>
<li>more content to show scrolling.</li>
<li>more content to show scrolling.</li>
<li>more content to show scrolling.</li>
<li>more content to show scrolling.</li>
<li>more content to show scrolling.</li>
<li>more content to show scrolling.</li>
<li>more content to show scrolling.</li>
<li>more content to show scrolling.</li>
<li>more content to show scrolling.</li>
<li>more content to show scrolling.</li>
<li>more content to show scrolling.</li>
<li>more content to show scrolling.</li>
<li>more content to show scrolling.</li>
<li>more content to show scrolling.</li>
<li>more content to show scrolling.</li>
<li>more content to show scrolling.</li>
<li>more content to show scrolling.</li>
<li>more content to show scrolling.</li>
<li>more content to show scrolling.</li>
<li>more content to show scrolling.</li>
<li>more content to show scrolling.</li>
<li>more content to show scrolling.</li>
<li>more content to show scrolling.</li>
<li>more content to show scrolling.</li>
<li>more content to show scrolling.</li>
<li>more content to show scrolling.</li>
<li>more content to show scrolling.</li>
<li>more content to show scrolling.</li>
<li>more content to show scrolling.</li>
<li>more content to show scrolling.</li>
<li>more content to show scrolling.</li>
<li>more content to show scrolling.</li>
<li>more content to show scrolling.</li>
<li>more content to show scrolling.</li>
<li>more content to show scrolling.</li>
<li>more content to show scrolling.</li>
</ol>
</section>
<script type="text/javascript" src="static/swiper-do-swipe.js"></script>
<script type="text/javascript" src="static/swiper-do-swipe-perspective.js"></script>
<script type="text/javascript">
var select_element = document.getElementById("effect");
var change_effect = function(){
swiper.effect = swiper_do_swipe_effects[get_effect()];
}
var get_effect = function(){
return select_element.options[select_element.selectedIndex].value;
}
select_element.onchange = change_effect;
var page_turn = function(event, $page, index){
//console.log(event, $page, index);
}
var swiper = swiper_do_swipe(
document.querySelectorAll("body > section"),
swiper_do_swipe_effects[get_effect()]);
swiper.onchange(page_turn).oninit(page_turn);
</script>
</body>
</html>