forked from codrops/Baraja
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
executable file
·338 lines (265 loc) · 10.7 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
<!DOCTYPE html>
<html lang="en" class="no-js">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Baraja: A Plugin for Spreading Items in a Card-Like Fashion</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="Baraja: A Plugin for Spreading Items in a Card-Like Fashion" />
<meta name="keywords" content="jquery, plugin, transform, css3, cards, spread, items, web development" />
<meta name="author" content="Codrops" />
<link rel="shortcut icon" href="../favicon.ico">
<link rel="stylesheet" type="text/css" href="css/baraja.css" />
<link rel="stylesheet" type="text/css" href="css/demo.css" />
<link rel="stylesheet" type="text/css" href="css/custom.css" />
<script type="text/javascript" src="js/modernizr.custom.79639.js"></script>
</head>
<body>
<div class="container">
<!-- Codrops top bar -->
<div class="codrops-top clearfix">
<a href="http://tympanus.net/Development/GammaGallery/">
<strong>« Previous Demo: </strong>Gamma Gallery
</a>
<span class="right">
<a href="http://dribbble.com/jdelamancha">Illustrations by Jason Custer</a>
<a href="http://tympanus.net/codrops/?p=12050">
<strong>Back to the Codrops Article</strong>
</a>
</span>
</div><!--/ Codrops top bar -->
<header class="clearfix">
<h1>Baraja <span>A plugin for spreading items in a card-like fashion</span></h1>
</header>
<section class="main">
<nav class="actions">
<span id="nav-fan">Fan right</span>
<span id="nav-fan2">Fan left</span>
<span id="nav-fan3">Fan right (asym.)</span>
<span id="nav-fan4">Fan left (asym.)</span>
<span id="nav-fan5">Rotated spread (horizontal)</span>
<span id="nav-fan6">Rotated spread (vertical)</span>
<span id="nav-fan7">Linear spread right</span>
<span id="nav-fan8">Linear spread left</span>
<span id="nav-fan9">Linear spread right (irregular)</span>
<span id="nav-fan10">Linear spread left (irregular)</span>
<span id="nav-fanOther1">other</span>
<span id="nav-fanOther2">other</span>
<span id="nav-fanOther3">other</span>
<span id="nav-fanOther4">other...</span>
<span id="add">Add items</span>
</nav>
<div class="baraja-demo">
<ul id="baraja-el" class="baraja-container">
<li><img src="images/1.jpg" alt="image1"/><h4>Coco Loko</h4><p>Total bicycle rights in blog four loko raw denim ex, helvetica sapiente odio placeat.</p></li>
<li><img src="images/2.jpg" alt="image2"/><h4>Vermouth Land</h4><p>Velit chambray fugiat, enim aesthetic esse ullamco typewriter.</p></li>
<li><img src="images/3.jpg" alt="image3"/><h4>Electrodynamics</h4><p>Before they sold out PBR magna jean shorts non seitan ea. Dolor wolf pop-up.</p></li>
<li><img src="images/4.jpg" alt="image4"/><h4>Retinal Bliss</h4><p>Locavore vero ad, before they sold out food truck bushwick helvetica.</p></li>
<li><img src="images/5.jpg" alt="image5"/><h4>Disco Fever</h4><p>Cillum laboris consequat, qui elit retro next level skateboard freegan hella.</p></li>
<li><img src="images/6.jpg" alt="image6"/><h4>Serenity</h4><p>Truffaut wes anderson hoodie 3 wolf moon labore, fugiat lomo iphone eiusmod vegan.</p></li>
<li><img src="images/7.jpg" alt="image7"/><h4>Dark Honor</h4><p>Chillwave mustache pinterest, marfa seitan umami id farm-to-table iphone.</p></li>
<li><img src="images/8.jpg" alt="image8"/><h4>Nested Happiness</h4><p>Minim post-ironic banksy american apparel iphone wayfarers.</p></li>
<li><img src="images/9.jpg" alt="image9"/><h4>Cherry Country</h4><p>Sint vinyl Austin street art odd future id trust fund, terry richardson cray.</p></li>
<li><img src="images/10.jpg" alt="image10"/><h4>Cherry Country</h4><p>Sint vinyl Austin street art odd future id trust fund, terry richardson cray.</p></li>
<li><img src="images/11.jpg" alt="image11"/><h4>Coco Loko</h4><p>Total bicycle rights in blog four loko raw denim ex, helvetica sapiente odio placeat.</p></li>
<li><img src="images/12.jpg" alt="image12"/><h4>Vermouth Land</h4><p>Velit chambray fugiat, enim aesthetic esse ullamco typewriter.</p></li>
<li><img src="images/3.jpg" alt="image3"/><h4>Electrodynamics</h4><p>Before they sold out PBR magna jean shorts non seitan ea. Dolor wolf pop-up.</p></li>
<li><img src="images/4.jpg" alt="image4"/><h4>Retinal Bliss</h4><p>Locavore vero ad, before they sold out food truck bushwick helvetica.</p></li>
<li><img src="images/5.jpg" alt="image5"/><h4>Disco Fever</h4><p>Cillum laboris consequat, qui elit retro next level skateboard freegan hella.</p></li>
<li><img src="images/6.jpg" alt="image6"/><h4>Serenity</h4><p>Truffaut wes anderson hoodie 3 wolf moon labore, fugiat lomo iphone eiusmod vegan.</p></li>
<li><img src="images/7.jpg" alt="image7"/><h4>Dark Honor</h4><p>Chillwave mustache pinterest, marfa seitan umami id farm-to-table iphone.</p></li>
<li><img src="images/8.jpg" alt="image8"/><h4>Nested Happiness</h4><p>Minim post-ironic banksy american apparel iphone wayfarers.</p></li>
</ul>
</div>
<nav class="actions light">
<span id="nav-prev"><</span>
<span id="nav-next">></span>
<span id="close">close</span>
</nav>
</section>
</div>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
<script type="text/javascript" src="js/jquery.baraja.js"></script>
<script type="text/javascript">
$(function() {
var $el = $( '#baraja-el' ),
baraja = $el.baraja();
// navigation
$( '#nav-prev' ).on( 'click', function( event ) {
baraja.previous();
} );
$( '#nav-next' ).on( 'click', function( event ) {
baraja.next();
} );
// simple fan
$( '#nav-fan' ).on( 'click', function( event ) {
baraja.fan( {
speed : 500,
easing : 'ease-out',
range : 90,
direction : 'right',
origin : { x : 25, y : 100 },
center : true
} );
} );
$( '#nav-fan2' ).on( 'click', function( event ) {
baraja.fan( {
speed : 500,
easing : 'ease-out',
range : 90,
direction : 'left',
// note that the x origin changes (symmetric)
origin : { x : 75, y : 100 },
center : true
} );
} );
// more realistic fan: without common origin (means the origin changes / increments by card )
$( '#nav-fan3' ).on( 'click', function( event ) {
baraja.fan( {
speed : 500,
easing : 'ease-out',
range : 90,
direction : 'right',
origin : { minX : 20, maxX : 80, y : 100 },
center : true,
translation : 60
} );
} );
$( '#nav-fan4' ).on( 'click', function( event ) {
baraja.fan( {
speed : 500,
easing : 'ease-out',
range : 90,
direction : 'left',
origin : { minX : 20, maxX : 80, y : 100 },
center : true,
translation : 60
} );
} );
// playing with different origins and ranges
$( '#nav-fan5' ).on( 'click', function( event ) {
baraja.fan( {
speed : 500,
easing : 'ease-out',
range : 100,
direction : 'right',
origin : { x : 50, y : 200 },
center : true
} );
} );
$( '#nav-fan6' ).on( 'click', function( event ) {
baraja.fan( {
speed : 500,
easing : 'ease-out',
range : 80,
direction : 'left',
origin : { x : 200, y : 50 },
center : true
} );
} );
// center false, playing with translation
$( '#nav-fan7' ).on( 'click', function( event ) {
baraja.fan( {
speed : 500,
easing : 'ease-out',
range : 20,
direction : 'right',
origin : { x : 50, y : 200 },
center : false,
translation : 300
} );
} );
$( '#nav-fan8' ).on( 'click', function( event ) {
baraja.fan( {
speed : 500,
easing : 'ease-out',
range : 20,
direction : 'left',
origin : { x : 50, y : 200 },
center : false,
translation : 300
} );
} );
// using scatter : true
$( '#nav-fan9' ).on( 'click', function( event ) {
baraja.fan( {
speed : 500,
easing : 'ease-out',
range : 20,
direction : 'right',
origin : { x : 50, y : 200 },
center : false,
translation : 300,
scatter : true
} );
} );
$( '#nav-fan10' ).on( 'click', function( event ) {
baraja.fan( {
speed : 500,
easing : 'ease-out',
range : 20,
direction : 'left',
origin : { x : 50, y : 200 },
center : false,
translation : 300,
scatter : true
} );
} );
$( '#nav-fanOther1' ).on( 'click', function( event ) {
baraja.fan( {
speed : 500,
easing : 'ease-out',
range : 130,
direction : 'left',
origin : { x : 25, y : 100 },
center : false
} );
} );
$( '#nav-fanOther2' ).on( 'click', function( event ) {
baraja.fan( {
speed : 500,
easing : 'ease-out',
range : 360,
direction : 'left',
origin : { x : 50, y : 90 },
center : false
} );
} );
$( '#nav-fanOther3' ).on( 'click', function( event ) {
baraja.fan( {
speed : 500,
easing : 'ease-out',
range : 330,
direction : 'left',
origin : { x : 50, y : 100 },
center : true
} );
} );
$( '#nav-fanOther4' ).on( 'click', function( event ) {
baraja.fan( {
speed : 500,
easing : 'ease-out',
range : 90,
direction : 'right',
origin : { minX : 20, maxX : 80, y : 100 },
center : true,
translation : 60,
scatter : true
} );
} );
// close the baraja
$( '#close' ).on( 'click', function( event ) {
baraja.close();
} );
// example of how to add more items
$( '#add' ).on( 'click', function( event ) {
if( $( this ).hasClass( 'disabled' ) ) {
return false;
}
$( this ).addClass( 'disabled' );
baraja.add( $('<li><img src="images/6.jpg" alt="image6"/><h4>Serenity</h4><p>Truffaut wes anderson hoodie 3 wolf moon labore, fugiat lomo iphone eiusmod vegan.</p></li><li><img src="images/7.jpg" alt="image7"/><h4>Dark Honor</h4><p>Chillwave mustache pinterest, marfa seitan umami id farm-to-table iphone.</p></li><li><img src="images/8.jpg" alt="image8"/><h4>Nested Happiness</h4><p>Minim post-ironic banksy american apparel iphone wayfarers.</p></li><li><img src="images/9.jpg" alt="image9"/><h4>Cherry Country</h4><p>Sint vinyl Austin street art odd future id trust fund, terry richardson cray.</p></li>') );
} );
});
</script>
</body>
</html>