forked from brutaldesign/swipebox
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
356 lines (318 loc) · 12.6 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
<!DOCTYPE HTML>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<meta name="description" content="A touchable jQuery lightbox plugin for desktop, mobile and tablet" />
<meta property="og:site_name" content="Swipebox" />
<meta property="og:url" content="http://brutaldesign.github.com/swipebox/" />
<meta property="og:image" content="http://swipebox.brutaldesign.com/meta/swipe250.jpg" />
<meta property="og:type" content="article" />
<meta property="og:title" content="Swipebox | A touchable jQuery lightbox" />
<meta property="og:description" content="Swipebox is a jQuery lightbox plugin for desktop, mobile and tablet">
<meta itemprop="name" content="Swipebox | A touchable jQuery lightbox">
<meta itemprop="image" content="http://swipebox.brutaldesign.com/meta/swipe250.jpg">
<meta itemprop="description" content="Swipebox is a jQuery lightbox plugin for desktop, mobile and tablet">
<link rel="stylesheet" href="css/style.css">
<link rel="stylesheet" href="source/swipebox.css">
<title>Swipebox | A touchable jQuery lightbox</title>
<!-- share buttons -->
<script type="text/javascript">(function(doc, script) {
var js,
fjs = doc.getElementsByTagName(script)[0],
add = function(url, id) {
if (doc.getElementById(id)) {return;}
js = doc.createElement(script);
js.src = url;
id && (js.id = id);
fjs.parentNode.insertBefore(js, fjs);
};add("//connect.facebook.net/en_US/all.js#xfbml=1", "facebook-jssdk");
add("//platform.twitter.com/widgets.js", "twitter-wjs");
}(document, "script"));
</script>
<!-- end share buttons -->
</head>
<body>
<div id="fb-root"></div>
<a href="https://github.com/brutaldesign/swipebox" id="fork-this"></a>
<div id="main">
<div class="wrap">
<header>
<h1>Swipebox.</h1>
<p class="tagline">A touchable jQuery lightbox</p>
<div id="share">
<div id="twitter-button">
<a href="https://twitter.com/share" class="twitter-share-button" data-url="http://brutaldesign.github.com/swipebox" data-text="Swipebox | A touchable jQuery lightbox" data-via="brutaldesign">Tweet</a>
</div>
<div id="fb-like">
<div class="fb-like" data-href="http://brutaldesign.github.com/swipebox/" data-send="false" data-layout="button_count" data-width="110" data-show-faces="false" data-colorscheme="light" data-action="like"></div>
</div>
</div>
<ul class="index-table">
<li><a href="#what">What is Swipebox ?</a>
<ul>
<li><a href="#features">Main Features</a></li>
<li><a href="#compatibility">Compatibility</a></li>
</ul>
</li>
<li><a href="#try">Try it</a></li>
<li><a href="#basic">Basic Usage</a></li>
<li><a href="#advanced">Advanced</a>
<ul>
<li><a href="#rel">Use Rel Attribute</a></li>
<li><a href="#video">Youtube support</a></li>
<li><a href="#dynamic">Load slides dynamically</a></li>
<li><a href="#refresh">Refresh Method</a></li>
<li><a href="#open">Check open state</a></li>
<li><a href="#options">Options</a></li>
</ul>
</li>
<li><a href="#download">Download</a></li>
</ul>
</header>
<hr>
<section id="presentation">
<div id="what"></div>
<h2>What is Swipebox ?</h2>
<p>Swipebox is a jQuery "lightbox" plugin for desktop, mobile and tablet.</p>
<div id="features"></div>
<h3>Main Features</h3>
<ol>
<li>Swipe gestures for mobile</li>
<li>Keyboard Navigation for desktop</li>
<li>CSS transitions with jQuery fallback</li>
<li>Retina support for UI icons</li>
<li>Easy CSS customization</li>
</ol>
<div id="compatibility"></div>
<h3>Compatibility</h3>
<p>Chrome, Safari, Firefox, Opera, IE8+, IOS4+, Android, windows phone.</p>
</section>
<hr>
<section id="exemple" class="clearfix">
<div id="try"></div>
<h2>Try it</h2>
<div class="box">
<a href="http://swipebox.brutaldesign.com/assets/full/nuke.jpg" class="swipebox" title="Nuke">
<img src="http://swipebox.brutaldesign.com/assets/nuke_thumb.jpg" alt="nuke">
</a>
</div>
<div class="box">
<a href="http://swipebox.brutaldesign.com/assets/full/leap.jpg" class="swipebox" title="Leap">
<img src="http://swipebox.brutaldesign.com/assets/leap_thumb.jpg" alt="leap">
</a>
</div>
<div class="box">
<a href="http://swipebox.brutaldesign.com/assets/full/reine.jpg" class="swipebox" title="Reine">
<img src="http://swipebox.brutaldesign.com/assets/reine_thumb.jpg" alt="reine">
</a>
</div>
<div class="box">
<a href="http://swipebox.brutaldesign.com/assets/full/neptune.jpg" class="swipebox" title="Neptune">
<img src="http://swipebox.brutaldesign.com/assets/neptune_thumb.jpg" alt="neptune">
</a>
</div>
</section>
<hr>
<section id="usage">
<div id="basic"></div>
<h2>Basic Usage</h2>
<h3>Javascript</h3>
<p>Include jquery and the swipebox script in your <code>head</code> tags or right before your <code>body</code> closing tag.</p>
<pre><script src="lib/jquery-2.0.3.js"></script>
<script src="source/jquery.swipebox.js"></script></pre>
<h3>CSS</h3>
<p>Include the swipebox CSS style in your <code>head</code> tags.</p>
<pre><link rel="stylesheet" href="source/swipebox.css"></pre>
<h3>HTML</h3>
<p>Use a specific class for your links and use the title attribute as caption.</p>
<pre><a href="big/image.jpg" class="swipebox" title="My Caption">
<img src="small/image.jpg" alt="image">
</a></pre>
<h3>Fire the plugin</h3>
<p>Bind the swipebox behaviour on every link with the "swipebox" class.</p>
<pre><script type="text/javascript">
jQuery(function($) {
$(".swipebox").swipebox();
});
</script>
</pre>
</section>
<hr>
<section id="advanced-usage">
<div id="advanced"></div>
<h2>Advanced</h2>
<div id="rel"></div>
<h3>Use "rel" Attribute</h3>
<p>You can add a <code>rel</code> attribute to your links to seperate galleries.</p>
<pre>
<span><!-- Gallery 1 --></span>
<a rel="gallery-1" href="big/image1.jpg" class="swipebox">
<img src="small/image1.jpg" alt="image">
</a>
<a rel="gallery-1" href="big/image2.jpg" class="swipebox">
<img src="small/image2.jpg" alt="image">
</a>
<span><!-- Gallery 2 --></span>
<a rel="gallery-2" href="big/image3.jpg" class="swipebox">
<img src="small/image3.jpg" alt="image">
</a>
<a rel="gallery-2" href="big/image4.jpg" class="swipebox">
<img src="small/image4.jpg" alt="image">
</a></pre>
<div id="video"></div>
<h3>Youtube support</h3>
<p>Simply paste a youtube video URL in your href attribute. The script will automatically check if it's a Youtube URL and open the video in the swipebox.</p>
<p>
<a class="swipebox-video" href="http://www.youtube.com/watch?v=XSGBVzeBUbk">My Video</a>
</p>
<pre><a class="swipebox-video" rel="youtube" href="http://www.youtube.com/watch?v=XSGBVzeBUbk">My Videos</a></pre>
<div id="dynamic"></div>
<h3>Load slides dynamically</h3>
<p>You can set your gallery dynamically by passing an array object to the swipebox.</p>
<p><a id="gallery" href="#">View gallery</a></p>
<pre>
$("#gallery").click(function(e){
e.preventDefault();
$.swipebox([
{href:'big/image1.jpg', title:'My Caption'},
{href:'big/image2.jpg', title:'My Second Caption'}
]);
});
</pre>
<div id="refresh"></div>
<h3>Refresh Method</h3>
<p>The refresh method allows you to reload the slides if the DOM has changed.</p>
<pre>var swipeboxInstance = $(".a:visible").swipebox();
// Use the refresh method after your event is completed
swipeboxInstance.refresh();</pre>
<p>For exemple, if you use <a href="http://isotope.metafizzy.co/demos/filtering.html" target="_blank">isotope</a> filter.</p>
<ul id="filter">
<li><a href="#" data-filter="item">All</a></li>
<li><a href="#" data-filter="sea">Sea</a></li>
<li><a href="#" data-filter="beach">Beach</a></li>
</ul>
<div id="grid" class="clearfix">
<div class="box item beach">
<a href="http://swipebox.brutaldesign.com/assets/full/nuke.jpg" class="swipebox-isotope" title="Nuke">
<img src="http://swipebox.brutaldesign.com/assets/nuke_thumb.jpg" alt="nuke">
</a>
</div>
<div class="box item sea">
<a href="http://swipebox.brutaldesign.com/assets/full/leap.jpg" class="swipebox-isotope" title="Leap">
<img src="http://swipebox.brutaldesign.com/assets/leap_thumb.jpg" alt="leap">
</a>
</div>
<div class="box item beach">
<a href="http://swipebox.brutaldesign.com/assets/full/reine.jpg" class="swipebox-isotope" title="Reine">
<img src="http://swipebox.brutaldesign.com/assets/reine_thumb.jpg" alt="reine">
</a>
</div>
<div class="box item sea">
<a href="http://swipebox.brutaldesign.com/assets/full/neptune.jpg" class="swipebox-isotope" title="Neptune">
<img src="http://swipebox.brutaldesign.com/assets/neptune_thumb.jpg" alt="neptune">
</a>
</div>
</div>
<pre>
<span>// Use the swipebox only for visible elements</span>
var swipeboxInstance = $(".swipebox-isotope:not(.isotope-hidden .swipebox-isotope)").swipebox();
<span>// Callback function that fire the refresh method, once the animation is finished</span>
onAnimationCompleted = function(){
swipeboxInstance.refresh();
};
// Isotope stuff
optionFilterLinks = $('#filter').find('a');
optionFilterLinks.attr('href', '#');
optionFilterLinks.click( function(){
var selector = $(this).attr('data-filter');
$('#grid').isotope({
filter : '.' + selector,
itemSelector : '.item',
layoutMode : 'fitRows',
animationEngine : 'best-available',
}, onAnimationCompleted); <span>// callback here</span>
optionFilterLinks.removeClass('active');
$(this).addClass('active');
return false;
});</pre>
<div id="open"></div>
<h3>Check open state</h3>
<pre>if ($.swipebox.isOpen){
// do stuff
}</pre>
<div id="options"></div>
<h3>Options</h3>
<pre><script type="text/javascript">
jQuery(function($) {
$(".swipebox").swipebox({
useCSS : true, <span>// false will force the use of jQuery for animations</span>
hideBarsDelay : 3000, <span>// 0 to always show caption and action bar</span>
videoMaxWidth : 1140, <span>// videos max width</span>
beforeOpen: function(){}, <span>// called before opening</span>
afterClose: function(){} <span>// called after closing</span>
});
});
</script>
</pre>
</section>
<section id="action">
<div id="download"></div>
<p><a class="button" href="https://github.com/brutaldesign/swipebox/archive/master.zip">Download</a> <a class="button" href="https://github.com/brutaldesign/swipebox">View Source</a></p>
</section>
<hr>
<section id="credits">
<p><strong>Credits</strong></p>
<p>Photos by <a href="http://www.flickr.com/photos/astragony/" target="_blank">Daniele Zedda</a></p>
</section>
</div>
<footer>
<div class="wrap">
<a href="http://csag.co" target="_blank">Constantin Saguin</a> | <a href="http://twitter.com/brutaldesign" target="_blank">@brutaldesign</a>
</div>
</footer>
</div>
<script src="lib/ios-orientationchange-fix.js"></script>
<script src="lib/jquery-2.0.3.min.js"></script>
<script src="lib/jquery.isotope.min.js"></script>
<script src="source/jquery.swipebox.js"></script>
<script type="text/javascript">
jQuery(function($) {
/* Basic Gallery */
$(".swipebox").swipebox();
/* Video */
$(".swipebox-video").swipebox();
/* Dynamic Gallery */
$("#gallery").click(function(e){
e.preventDefault();
$.swipebox([
{ href : 'http://swipebox.brutaldesign.com/assets/full/reine.jpg', title : 'My Caption' },
{ href : 'http://swipebox.brutaldesign.com/assets/full/nuke.jpg', title : 'My Second Caption' }
]);
});
/* Isotope */
var swipeboxInstance = $(".swipebox-isotope:not(.isotope-hidden .swipebox-isotope)").swipebox();
var $container = $('#grid');
var optionFilter = $('#filter'),
optionFilterLinks = optionFilter.find('a');
optionFilterLinks.attr('href', '#');
onAnimationCompleted = function(){
swipeboxInstance.refresh();
};
optionFilterLinks.click( function(){
var selector = $(this).attr('data-filter');
$container.isotope({
filter : '.' + selector,
itemSelector : '.item',
layoutMode : 'fitRows',
animationEngine : 'best-available',
}, onAnimationCompleted);
// Highlight the correct filter
optionFilterLinks.removeClass('active');
$(this).addClass('active');
return false;
});
});
</script>
</body>
</html>