-
Notifications
You must be signed in to change notification settings - Fork 4
/
index.html
411 lines (377 loc) · 11.9 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
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<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="javascript, plugin, transform, css3, cards, spread, items, web development" />
<meta name="author" content="Codrops" />
<link rel="stylesheet" type="text/css" href="../dist/baraja.min.css" />
<link rel="stylesheet" type="text/css" href="css/demo.css" />
<link rel="stylesheet" type="text/css" href="css/custom.css" />
</head>
<body>
<div class="container">
<!-- Codrops top bar -->
<div class="codrops-top clearfix">
<a href="https://github.com/nuxy/baraja-js">
<strong>Github Project</strong>
</a>
<span class="right">
<a href="http://dribbble.com/jdelamancha">Illustrations by Jason Custer</a>
<a href="http://tympanus.net/codrops/?p=12050">
<strong>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="Coco Loko" />
<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="Vermouth Land" />
<h4>Vermouth Land</h4>
<p>Velit chambray fugiat, enim aesthetic esse ullamco typewriter.</p>
</li>
<li class="addItems">
<img src="images/3.jpg" alt="Electrodynamics" />
<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="Retinal Bliss" />
<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="Disco Fever" />
<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="Serenity" />
<h4>Serenity</h4>
<p>Truffaut wes anderson hoodie 3 wolf moon labore, fugiat lomo iphone eiusmod vegan.</p>
</li>
<li class="addItems">
<img src="images/7.jpg" alt="Dark Honor" />
<h4>Dark Honor</h4>
<p>Chillwave mustache pinterest, marfa seitan umami id farm-to-table iphone.</p>
</li>
<li class="addItems">
<img src="images/8.jpg" alt="Nested Happiness" />
<h4>Nested Happiness</h4>
<p>Minim post-ironic banksy american apparel iphone wayfarers.</p>
</li>
<li>
<img src="images/9.jpg" alt="Lobster Maker" />
<h4>Lobster Maker</h4>
<p>Far deference cupidatat non proident escape, he could greatest mister uninspired.</p>
</li>
<li>
<img src="images/10.jpg" alt="Cherry Country" />
<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="Future Dynamo" />
<h4>Future Dynamo</h4>
<p>Delicacy omnis nice, well upright, would loral sed quia small dream.</p>
</li>
<li>
<img src="images/12.jpg" alt="Breaking Bad" />
<h4>Breaking Bad</h4>
<p>French it rain adipisci necessary textile war ullam corporis time.</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="../dist/baraja.min.js"></script>
<script type="text/javascript">
var baraja = window.baraja(document.getElementById('baraja-el'));
// Left arrow
document.getElementById('nav-prev')
.addEventListener('click', function() {
baraja.last();
});
// Right arrow
document.getElementById('nav-next')
.addEventListener('click', function() {
baraja.next();
});
// Fan right
document.getElementById('nav-fan')
.addEventListener('click', function() {
baraja.fan({
direction: 'right',
easing: 'ease-out',
origin: {
x: 25,
y: 100
},
speed: 500,
range: 90,
center: true
});
});
// Fan left
document.getElementById('nav-fan2')
.addEventListener('click', function() {
baraja.fan({
direction: 'left',
easing: 'ease-out',
origin: {
x: 75,
y: 100
},
speed: 500,
range: 90,
center: true
});
});
// Fan right (asym.)
document.getElementById('nav-fan3')
.addEventListener('click', function() {
baraja.fan({
direction: 'right',
easing: 'ease-out',
origin: {
minX: 20,
maxX: 80,
y: 100
},
speed: 500,
range: 90,
translation: 60,
center: true
});
});
// Fan left (asym.)
document.getElementById('nav-fan4')
.addEventListener('click', function() {
baraja.fan({
direction: 'left',
easing: 'ease-out',
origin: {
minX: 20,
maxX: 80,
y: 100
},
speed: 500,
range: 90,
translation: 60,
center: true
});
});
// Rotated spread (horizontal)
document.getElementById('nav-fan5')
.addEventListener('click', function() {
baraja.fan({
direction: 'right',
easing: 'ease-out',
origin: {
x: 50,
y: 200
},
speed: 500,
range: 100,
center: true
});
});
// Rotated spread (vertical)
document.getElementById('nav-fan6')
.addEventListener('click', function() {
baraja.fan({
direction: 'left',
easing: 'ease-out',
origin: {
x: 200,
y: 50
},
speed: 500,
range: 80,
center: true
});
});
// Linear spread right
document.getElementById('nav-fan7')
.addEventListener('click', function() {
baraja.fan({
direction: 'right',
easing: 'ease-out',
origin: {
x: 50,
y: 200
},
speed: 500,
range: 20,
translation: 300,
center: false
});
});
// Linear spread left
document.getElementById('nav-fan8')
.addEventListener('click', function() {
baraja.fan({
direction: 'left',
easing: 'ease-out',
origin: {
x: 50,
y: 200
},
speed: 500,
range: 20,
translation : 300,
center: false
});
});
// Linear spread right (irregular)
document.getElementById('nav-fan9')
.addEventListener('click', function() {
baraja.fan({
direction: 'right',
easing: 'ease-out',
origin: {
x: 50,
y: 200
},
speed: 500,
range: 20,
translation: 300,
center: false,
scatter: true
});
});
// Linear spread left (irregular)
document.getElementById('nav-fan10')
.addEventListener('click', function() {
baraja.fan({
direction: 'left',
easing: 'ease-out',
origin: {
x: 50,
y: 200
},
speed: 500,
range: 20,
translation: 300,
center: false,
scatter: true
});
});
// Other 1
document.getElementById('nav-fanOther1')
.addEventListener('click', function() {
baraja.fan({
direction: 'left',
easing: 'ease-out',
origin: {
x: 25,
y: 100
},
speed: 500,
range: 130,
center: false
});
});
// Other 2
document.getElementById('nav-fanOther2')
.addEventListener('click', function() {
baraja.fan({
direction: 'left',
easing: 'ease-out',
origin: {
x: 50,
y: 90
},
speed: 500,
range: 360,
center: false
});
});
// Other 3
document.getElementById('nav-fanOther3')
.addEventListener('click', function() {
baraja.fan({
direction: 'left',
easing: 'ease-out',
origin: {
x: 50,
y: 100
},
speed: 500,
range: 330,
center: true
});
});
// Other 4
document.getElementById('nav-fanOther4')
.addEventListener('click', function() {
baraja.fan({
direction: 'right',
easing: 'ease-out',
origin: {
minX: 20,
maxX: 80,
y: 100
},
speed: 500,
range: 90,
translation: 60,
center: true,
scatter: true
});
});
// Close
document.getElementById('close')
.addEventListener('click', function() {
baraja.close();
});
// Add items
var addElm = document.getElementById('add');
addElm.addEventListener('click', function() {
if (!addElm.classList.contains('disabled')) {
addElm.classList.add('disabled');
var elements = document.querySelectorAll('.addItems');
var html = '';
elements.forEach(function(elm) {
html += elm.outerHTML;
});
baraja.add(html);
}
});
</script>
</body>
</html>