forked from withassociates/microfiche.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
391 lines (304 loc) · 13.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
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=810">
<title>Microfiche.js</title>
<link rel="stylesheet" href="vendor/prettify.css">
<link rel="stylesheet" href="microfiche.css">
<link rel="stylesheet" href="microfiche.demo.css">
<script src="vendor/jquery-1.7.1.js"></script>
<script src="vendor/prettify.js"></script>
<script src="microfiche.js"></script>
<script type="text/javascript" src="http://fast.fonts.com/jsapi/b4bd1e58-b76c-41db-beda-55eac402a457.js"></script>
<script>
function example(id) {
document.write(
'<div class="example" id="' + id + '">' +
'<div>' +
'<ul>' +
'<li><img src="images/1.jpg" width="160" height="160"></li>' +
'<li><img src="images/2.jpg" width="160" height="160"></li>' +
'<li><img src="images/3.jpg" width="160" height="160"></li>' +
'<li><img src="images/4.jpg" width="160" height="160"></li>' +
'<li><img src="images/5.jpg" width="160" height="160"></li>' +
'<li><img src="images/6.jpg" width="160" height="160"></li>' +
'<li><img src="images/7.jpg" width="160" height="160"></li>' +
'<li><img src="images/8.jpg" width="160" height="160"></li>' +
'<li><img src="images/9.jpg" width="160" height="160"></li>' +
'<li><img src="images/10.jpg" width="160" height="160"></li>' +
'<li><img src="images/11.jpg" width="160" height="160"></li>' +
'<li><img src="images/12.jpg" width="160" height="160"></li>' +
'<li><img src="images/13.jpg" width="160" height="160"></li>' +
'<li><img src="images/14.jpg" width="160" height="160"></li>' +
'</ul>' +
'</div>' +
'</div>'
);
}
</script>
</head>
<body>
<div class="body-subcontainer">
<section id="heading">
<h1>Microfiche.js</h1>
<h3>With Associates</h3>
<h2>v1.7.0</h2>
</section>
<a href="http://github.com/withassociates/microfiche.js"><img style="position: absolute; top: 0; right: 0; border: 0;" src="https://s3.amazonaws.com/github/ribbons/forkme_right_green_007200.png" alt="Fork me on GitHub"></a>
<p>A carousel library made
<a href="http://withassociates.com/">With Associates</a>
focusing on performance, simplicity and touch.</p>
<p>Check out our
<a href="http://github.com/withassociates/microfiche.js">project page on GitHub</a>
and the <a href="docs/microfiche.html">annotated source</a>.</p>
<hr>
<h2>Installation</h2>
<p><a href="https://raw.github.com/withassociates/microfiche.js/master/microfiche.js">Download microfiche.js here</a></p>
<p>Microfiche requires <a href="http://jquery.com/">jQuery</a> ~> 1.7</p>
<p>You’ll want to include the following at the appropriate point in your page:</p>
<pre class="prettyprint">
<script src="path/to/jquery.js"></script>
<script src="path/to/microfiche.js"></script>
</pre>
<hr>
<h2>Usage</h2>
<h3>Defaults</h3>
<div class="demo">
<p><code class="prettyprint">$('#default').microfiche();</code></p>
<script>example('default')</script>
<script>$('#default').microfiche()</script>
</div>
<h3>Options</h3>
<div class="demo">
<p><code class="prettyprint">$('#cyclic').microfiche({ cyclic: true });</code></p>
<script>example('cyclic')</script>
<script>$('#cyclic').microfiche({ cyclic: true })</script>
</div>
<div class="demo">
<p><code class="prettyprint">$('#buttons').microfiche({ buttons: false });</code></p>
<script>example('buttons')</script>
<script>$('#buttons').microfiche({ buttons: false })</script>
</div>
<div class="demo">
<p><code class="prettyprint">$('#bullets').microfiche({ bullets: false });</code></p>
<script>example('bullets')</script>
<script>$('#bullets').microfiche({ bullets: false })</script>
</div>
<div class="demo">
<p><code class="prettyprint">$('#keyboard').microfiche({ keyboard: true });</code></p>
<script>example('keyboard')</script>
<script>$('#keyboard').microfiche({ keyboard: true })</script>
</div>
<div class="demo">
<p><code class="prettyprint">$('#click').microfiche({ clickToAdvance: true });</code></p>
<script>example('click')</script>
<script>$('#click').microfiche({ clickToAdvance: true })</script>
</div>
<h3>Commands</h3>
<p>Commands are passed to the microfiche method as options, and may be passed at any point.<br>
In this example, the <code class="prettyprint">slideByPages(1)</code> command is performed immediately
after Microfiche has finished setting up.</p>
<div class="demo">
<p><code class="prettyprint">$('#commands').microfiche({ slideByPages: 1 });</code></p>
<script>example('commands')</script>
<script>$('#commands').microfiche({ slideByPages: 1 })</script>
<p>
<button onclick="$('#commands').microfiche({ slideByPages: -1 }); return false;">Run →</button> <code class="prettyprint">$('#commands').microfiche({ slideByPages: -1 })</code><br>
<button onclick="$('#commands').microfiche({ slideByPages: 1 }); return false;">Run →</button> <code class="prettyprint">$('#commands').microfiche({ slideByPages: 1 })</code><br>
<button onclick="$('#commands').microfiche({ slideToPoint: 0 }); return false;">Run →</button> <code class="prettyprint">$('#commands').microfiche({ slideToPoint: 0 })</code><br>
<button onclick="$('#commands').microfiche({ jumpToPoint: 0 }); return false;">Run →</button> <code class="prettyprint">$('#commands').microfiche({ jumpToPoint: 0 })</code><br>
<button onclick="$('#commands').microfiche({ jumpToPage: 2 }); return false;">Run →</button> <code class="prettyprint">$('#commands').microfiche({ jumpToPage: 2 })</code>
</p>
</div>
<h3>Events</h3>
<p>Microfiche emits the following events:</p>
<ul>
<li><code class="prettyprint">'microfiche:willMove'</code></li>
<li><code class="prettyprint">'microfiche:didMove'</code></li>
</ul>
<p>You can listen for them in the usual way:</p>
<div class="demo">
<p><pre class="prettyprint">
$('#events').microfiche().on('microfiche:willMove microfiche:didMove', function(event) {
$('#events-console').html(event.type);
});
</pre></p>
<script>example('events')</script>
<script>
$('#events').microfiche().on('microfiche:willMove microfiche:didMove', function(event) {
$('#events-console').html(event.type);
});
</script>
<p><strong>Event received:</strong> <code id="events-console">-</code></p>
</div>
<h3>Talking to Microfiche Directly</h3>
<p>Microfiche has some useful methods that return values, and so cannot
be used through the aforementioned jQuery style syntax. The microfiche
object itself is available via jQuery’ <code>data</code> method.</p>
<p><code class="prettyprint">$('.my-element').data('microfiche');</code></p>
<h3>Methods</h3>
<div class="demo">
<p><pre class="prettyprint">
var m = $('#methods').microfiche().data('microfiche');
m.currentPageIndex() // returns 0-index of the current page
m.totalPageCount() // returns the number of pages as an integer
m.min() // returns the minimum (left-most) position
m.max() // returns the maximum (right-most) position
</pre></p>
<script>example('methods')</script>
<script>
var m = $('#methods').microfiche().data('microfiche');
document.write('<pre class="prettyprint">' +
'currentPageIndex: ' + m.currentPageIndex() + '<br>' +
' totalPageCount: ' + m.totalPageCount() + '<br>' +
' min: ' + m.min() + '<br>' +
' max: ' + m.max() +
'</pre>');
</script>
</div>
<h3>Autoplay</h3>
<p>To have Microfiche pause rotation when the user hovers over the
carousel, set <code>autopause</code> to <code>true</code>.</p>
<div class="demo">
<p><pre class="prettyprint">
$('#autoplay').microfiche({
cyclic: true,
autoplay: 3,
autopause: true
});
</pre></p>
<script>example('autoplay')</script>
<script>
$('#autoplay').microfiche({ cyclic: true, autoplay: 3, autopause: true });
</script>
</div>
<h3>Refresh</h3>
<p>To refresh an existing Microfiche’s controls and content to adjust to a new container size,
call the <code>refresh</code> method.</p>
<div class="demo">
<p><pre class="prettyprint">$('#refresher').microfiche({ cyclic: true });</pre></p>
<script>example('refresher')</script>
<script>
$('#refresher').microfiche({ cyclic: true });
</script>
<p>
<button onclick="$('#refresher').css('width', '340px'); return false;">Resize Parent →</button>
<code class="prettyprint"> $('#refresher').css('width', '340px');</code>
<br />
<button onclick="$('#refresher').microfiche({ refresh: true }); return false;">Refresh →</button>
<code class="prettyprint">$('#refresher').microfiche({ refresh: true });</code>
</p>
</div>
<h3>RefreshOnResize</h3>
<p>To have Microfiche automatically refresh when a window <code>resize</code> event is fired, set a debounce rate in ms for <code>refreshOnResize</code>. A value of <code>true</code> indicates a 250ms debounce.</p>
<p><pre class="prettyprint">
var r = $('#refreshonresize');
r.microfiche({ refreshOnResize: false }); // no refresh (default)
r.microfiche({ refreshOnResize: true }); // 250ms debounce
r.microfiche({ refreshOnResize: 0 }); // instant refresh
r.microfiche({ refreshOnResize: 100 }); // 100ms debounce
</pre></p>
<p>Resize your browser window until it's narrower than the example carousel below to see the carousel refresh.</p>
<p><pre class="prettyprint">
$('#refreshonresize').microfiche({ refreshOnResize: true });
</pre></p>
</div> <!-- .body-subcontainer -->
<div class="body-subcontainer responsive-width-demo">
<script>example('refreshonresize')</script>
<script>
$('#refreshonresize').microfiche({ refreshOnResize: true });
</script>
</div>
<div class="body-subcontainer">
<h3>Destroy</h3>
<p>To remove a microfiche element and all related event handlers, call <code>destroy</code>.</p>
<p><pre class="prettyprint">
$('.my-slideshow').microfiche({ destroy: true });
// or
$('.my-slideshow').data('microfiche').destroy();
</pre></p>
<hr>
<h2>Changelog</h2>
<h3>v1.7.0 (Mar 6, 2014)</h3>
<ul>
<li>Add destroy (thanks to <a href="https://github.com/bbakersmith">@bbakersmith</a>)</li>
<li>Improve refresh logic (thanks to <a href="https://github.com/bbakersmith">@bbakersmith</a>)</li>
</ul>
<h3>v1.6.0 (Feb 25, 2014)</h3>
<ul>
<li>Add refreshOnResize (thanks to <a href="https://github.com/bbakersmith">@bbakersmith</a>)</li>
</ul>
<h3>v1.5.0 (Feb 10, 2014)</h3>
<ul>
<li>Add refresh (thanks to <a href="https://github.com/bbakersmith">@bbakersmith</a>)</li>
</ul>
<h3>v1.4.0 (Sep 17, 2013)</h3>
<ul>
<li>Add autopause (thanks to <a href="https://github.com/davemcdermid">@davemcdermid</a>)</li>
</ul>
<h3>v1.3.4 (Apr 10, 2013)</h3>
<ul>
<li>Stricter feature detection</li>
</ul>
<h3>v1.3.3 (Jan 18, 2013)</h3>
<ul>
<li>jQuery Plugin Manifest</li>
</ul>
<h3>v1.3.2 (Sep 5, 2012)</h3>
<ul>
<li>Improve cyclic for touch</li>
</ul>
<h3>v1.3.1 (Sep 5, 2012)</h3>
<ul>
<li>Improve `autoplay` behaviour</li>
</ul>
<h3>v1.3.0 (Aug 31, 2012)</h3>
<ul>
<li>Add `autoplay` option</li>
</ul>
<h3>v1.2.2 (Jul 30, 2012)</h3>
<ul>
<li>Add `swipe` option</li>
</ul>
<h3>v1.2.1 (Jun 13, 2012)</h3>
<ul>
<li>Fix cyclic bug</li>
</ul>
<h3>v1.2.0 (May 26, 2012)</h3>
<ul>
<li>Add clickToAdvance</li>
</ul>
<h3>v1.1.0 (May 21, 2012)</h3>
<ul>
<li>Add keyboard controls</li>
</ul>
<h3>v1.0.0 (May 21, 2012)</h3>
<ul>
<li>First stable release</li>
</ul>
<hr>
<h2>License</h2>
<p>Copyright (c) 2012-2014 With Associates</p>
<p>Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:</p>
<p>The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.</p>
<p>THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.</p>
</div> <!-- .body-subcontainer -->
<script>prettyPrint()</script>
</body>
</html>