forked from poppa/carousel-js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
851 lines (801 loc) · 34.8 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
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
<!doctype html>
<html>
<head>
<meta content="width=device-width, initial-scale=1.0, user-scalable=yes" name="viewport">
<meta charset="utf-8">
<title>Carousel.js - A simple Javascript carousel</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.8.0/styles/default.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.8.0/styles/railscasts.min.css">
<link rel="stylesheet" href="site/build/demo.min.css">
<link rel="stylesheet" href="build/carousel.min.css">
<script src="build/carousel.min.js"></script>
<script src="site/build/tabs.min.js"></script>
<script src="site/build/site.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.8.0/highlight.min.js"></script>
<script>if (hljs) hljs.initHighlightingOnLoad();</script>
</head>
<body>
<header>
<div class="container">
<div class="site-width">
<div class="col left-col">
<h1>Carousel.js</h1>
<p>A simple JavaScript carousel</p>
</div>
<div class="col right-col">
<a href="https://github.com/poppa/carousel-js">
<i class="fa fa-code-fork"></i> me at <i class="fa fa-github"></i>
</a>
</div>
</div>
</div>
</header>
<div class='container intro'><div class='site-width'><p>A simple Javascript carousel with no library dependencies, with lazy image loading and support for multiple image sources for the same item depending on device size.</p><p>This is not a fancy pancy full fledged carousel in any way, and that will never
be the purpose or goal either. If that's what you want then check out <a href='http://kenwheeler.github.io/slick/'>Slick</a> instead.</p><hr><h2 id='howto'>Howto</h2><p>The size of the carousel is determined by the size of its outer container. This means
that the carousel wrapper must have a given height in some way.</p><hr><div class='scrollable'><h3 id='carousel-wrapper'>Carousel wrapper</h3><p>The outer most <code>div</code> element of the carousel that contain all carousel content</p><pre><code class='lang-html'><div class="carousel"
data-carousel-delay="8000"
data-carousel-indicators=""
data-carousel-touch-threshold="40%"
data-carousel-rubberband-swipe="1.5"></code></pre><table><thead><tr><th>Attribute </th><th>Description </th><th>Example</th></tr></thead><tbody><tr><td><code>data-carousel-delay</code> </td><td>Delay in milliseconds between rotations </td><td>10000</td></tr><tr><td><code>data-carousel-indicators</code> </td><td>Add indicators </td><td>No value</td></tr><tr><td><code>data-carousel-touch-threshold</code> </td><td>x distance to swipe before transition starts. Can be either a fixed number (px) or in percent (%) </td><td>100 or 50%</td></tr><tr><td><code>data-carousel-rubberband-swipe</code> </td><td>Give a rubber band effect when swipeing. </td><td>1.5</td></tr></tbody></table><hr><h3 id='carousel-slider'>Carousel slider</h3><p>This is the first child of the <strong>Carousel wrapper</strong>. This element takes no data attributes</p><pre><code class='lang-html'><div class="carousel-slider"></code></pre><hr><h3 id='carousel-item'>Carousel item</h3><p>This container is the wrapper for every item in the carousel.</p><pre><code class='lang-html'><div class="carousel-item"
data-carousel-href="http://domain.com/path/"></code></pre><table><thead><tr><th>Attribute </th><th>Description </th><th>Example</th></tr></thead><tbody><tr><td><code>data-carousel-href</code> </td><td>URL to goto when the item is clicked </td><td>/internal/path</td></tr></tbody></table><hr><h3 id='carousel-item-text'>Carousel item text</h3><p>This container can contain any html.</p><pre><code class='lang-html'><div class="carousel-item-text"></code></pre><hr><h3 id='carousel-item-image'>Carousel item image</h3><p>The image tag uses lazy loading so the best thing to do is to set the <code>src</code>
attribute to point to an empty pixel image or something like that and use
the <code>carousel-*</code> attributes for the real image sources. The <code>img</code> tag has support
for arbitrary number of sources for different devices (or strictly speaking
media width directives).</p><p>The <code>img</code> tag will not be displayed per se, but the <code>src</code> will rather be placed
as a background image on the <code>carousel-item</code> element. But the <code>img</code> will only be
visibly hidden and still be accessible for screen readers for which, for
instance, the <code>alt</code> attribute will serve a purpose.</p><p>If the media directive attributes are used the priciple of mobile first is applied,
so give the mobile version as value to the <code>data-carousel-src</code> attribute, which is
the default source attribute.</p><pre><code class='lang-html'><img src="empty/pixel.png" alt="Image description"
data-carousel-src="real-image.jpg"
data-carousel-mq-414="real-tablet-image.jpg"
data-carousel-mq-768="real-desktop-image.jpg"></code></pre><table><thead><tr><th>Attribute </th><th>Description </th><th>Example</th></tr></thead><tbody><tr><td><code>data-carousel-src</code> </td><td>Default image src </td><td>/images/img1.jpg</td></tr><tr><td><code>data-carousel-mq-(n)</code> </td><td>Alternative image sources. <code>(n)</code> is an arbitrary number which will be set to the media directive <code>@media (min-width: (n)px)</code> </td><td><code>data-carousel-mq-376='larger-than-iphone6-image.jpg'</code></td></tr></tbody></table><h3 id='the-carousel-global-object'>The <code>Carousel</code> global object</h3><p>This object has one static property (<code>null</code> by default) that if set with a
function that function will be called when a slider item is clicked (if the
<code>data-carousel-href</code> attribute is used on the item). </p><pre><code class='lang-js'>Carousel.clickBack = function(item) {
// Check something....
// Return false if you want to abort the click
// For instance:
if (item.href.indexOf('http:') > -1) {
window.top.location.href = item.href;
return false;
}
}</code></pre></div></div></div>
<div class="container p1">
<div class="site-width">
<h2>Full width <small> with relative height and font size</small></h2>
<ul role='tablist'>
<li class='active'>
<button id='tab-example-1' role='tab'
aria-controls='tab-view-example-1'
aria-selected='true'>Example</button>
</li>
<li>
<button id='tab-code-1' role='tab'
aria-controls='tab-view-code-1'
aria-selected='false'>HTML</button>
</li>
<li>
<button id='tab-css-1' role='tab'
aria-controls='tab-view-css-1'
aria-selected='false'>CSS</button>
</li></ul>
<div aria-labelledby='tab-example-1'
id='tab-view-example-1'
role='tabpanel' aria-hidden='false'>
<!-- catch(source) -->
<div class="outer-jsc"><!-- Implementation specific container -->
<!-- Begin Carousel -->
<div class="carousel"
data-carousel-delay="5000"
data-carousel-touch-threshold="160"
data-carousel-indicators="">
<div class="carousel-slider">
<!-- Begin item -->
<div class="carousel-item" data-carousel-href="https://pike.lysator.liu.se/">
<div class="carousel-item-text">
<h3>Header for the first item</h3>
<p>This is text for the first item</p>
</div>
<img src="images/transparent-pixel.gif"
data-carousel-src="images/img-mobile-1.png"
data-carousel-mq-768="images/img-desktop-1.png"
data-carousel-mq-414="images/img-tablet-1.png"
alt="Image 1">
</div>
<!-- /End item -->
<!-- Begin item -->
<div class="carousel-item">
<div class="carousel-item-text">
<h3>Header for the second item</h3>
<p>This is text for the second item</p>
</div>
<img src="images/transparent-pixel.gif"
data-carousel-src="images/img-mobile-2.png"
data-carousel-mq-768="images/img-desktop-2.png"
data-carousel-mq-414="images/img-tablet-2.png"
alt="Image 2">
</div>
<!-- /End item -->
<!-- Begin item -->
<div class="carousel-item">
<div class="arbitrary-content">
<div class="arbitrary-content-content">
<h2>This is arbitrary <code>HTML</code> content</h2>
<p>In a div I have control over and no one else...</p>
<p>This is not an <code>IMG</code> tag... but this is
a <a href="https://pike.lysator.liu.se">link</a>
</p>
</div>
</div>
</div>
<!-- /End item -->
<!-- Begin item -->
<div class="carousel-item">
<div class="carousel-item-text">
<h3>Header for the third item</h3>
<p>This is text for the third item</p>
</div>
<img src="images/transparent-pixel.gif"
data-carousel-src="images/img-mobile-3.png"
data-carousel-mq-768="images/img-desktop-3.png"
data-carousel-mq-414="images/img-tablet-3.png"
alt="Image 3">
</div>
<!-- /End item -->
<!-- Begin item -->
<div class="carousel-item">
<div class="carousel-item-text">
<h3>Header for the fourth item</h3>
<p>This is text for the fourth item</p>
</div>
<img src="images/transparent-pixel.gif"
data-carousel-src="images/img-mobile-4.png"
data-carousel-mq-768="images/img-desktop-4.png"
data-carousel-mq-414="images/img-tablet-4.png"
alt="Image 4">
</div>
<!-- /End item -->
<!-- Begin item -->
<div class="carousel-item">
<div class="carousel-item-text">
<h3>Header for the fifth item</h3>
<p>This is text for the fifth item</p>
</div>
<img src="images/transparent-pixel.gif"
data-carousel-src="images/img-mobile-5.png"
data-carousel-mq-768="images/img-desktop-5.png"
data-carousel-mq-414="images/img-tablet-5.png"
alt="Image 5">
</div>
<!-- /End item -->
<!-- Begin item -->
<div class="carousel-item">
<div class="carousel-item-text">
<h3>Header for the sixth item</h3>
<p>This is text for the sixth item</p>
</div>
<img src="images/transparent-pixel.gif"
data-carousel-src="images/img-mobile-6.png"
data-carousel-mq-768="images/img-desktop-6.png"
data-carousel-mq-414="images/img-tablet-6.png"
alt="Image 6">
</div>
<!-- /End item -->
</div>
</div>
<!-- /End Carousel -->
</div>
<!-- endcatch -->
</div>
<div aria-labelledby='tab-code-1'
id='tab-view-code-1'
role='tabpanel' aria-hidden='true'><pre><code class='html'><div class="outer-jsc"><!-- Implementation specific container -->
<!-- Begin Carousel -->
<div class="carousel"
data-carousel-delay="5000"
data-carousel-touch-threshold="160"
data-carousel-indicators="">
<div class="carousel-slider">
<!-- Begin item -->
<div class="carousel-item" data-carousel-href="https://pike.lysator.liu.se/">
<div class="carousel-item-text">
<h3>Header for the first item</h3>
<p>This is text for the first item</p>
</div>
<img src="images/transparent-pixel.gif"
data-carousel-src="images/img-mobile-1.png"
data-carousel-mq-768="images/img-desktop-1.png"
data-carousel-mq-414="images/img-tablet-1.png"
alt="Image 1">
</div>
<!-- /End item -->
<!-- Begin item -->
<div class="carousel-item">
<div class="carousel-item-text">
<h3>Header for the second item</h3>
<p>This is text for the second item</p>
</div>
<img src="images/transparent-pixel.gif"
data-carousel-src="images/img-mobile-2.png"
data-carousel-mq-768="images/img-desktop-2.png"
data-carousel-mq-414="images/img-tablet-2.png"
alt="Image 2">
</div>
<!-- /End item -->
<!-- Begin item -->
<div class="carousel-item">
<div class="arbitrary-content">
<div class="arbitrary-content-content">
<h2>This is arbitrary <code>HTML</code> content</h2>
<p>In a div I have control over and no one else...</p>
<p>This is not an <code>IMG</code> tag... but this is
a <a href="https://pike.lysator.liu.se">link</a>
</p>
</div>
</div>
</div>
<!-- /End item -->
<!-- Begin item -->
<div class="carousel-item">
<div class="carousel-item-text">
<h3>Header for the third item</h3>
<p>This is text for the third item</p>
</div>
<img src="images/transparent-pixel.gif"
data-carousel-src="images/img-mobile-3.png"
data-carousel-mq-768="images/img-desktop-3.png"
data-carousel-mq-414="images/img-tablet-3.png"
alt="Image 3">
</div>
<!-- /End item -->
<!-- Begin item -->
<div class="carousel-item">
<div class="carousel-item-text">
<h3>Header for the fourth item</h3>
<p>This is text for the fourth item</p>
</div>
<img src="images/transparent-pixel.gif"
data-carousel-src="images/img-mobile-4.png"
data-carousel-mq-768="images/img-desktop-4.png"
data-carousel-mq-414="images/img-tablet-4.png"
alt="Image 4">
</div>
<!-- /End item -->
<!-- Begin item -->
<div class="carousel-item">
<div class="carousel-item-text">
<h3>Header for the fifth item</h3>
<p>This is text for the fifth item</p>
</div>
<img src="images/transparent-pixel.gif"
data-carousel-src="images/img-mobile-5.png"
data-carousel-mq-768="images/img-desktop-5.png"
data-carousel-mq-414="images/img-tablet-5.png"
alt="Image 5">
</div>
<!-- /End item -->
<!-- Begin item -->
<div class="carousel-item">
<div class="carousel-item-text">
<h3>Header for the sixth item</h3>
<p>This is text for the sixth item</p>
</div>
<img src="images/transparent-pixel.gif"
data-carousel-src="images/img-mobile-6.png"
data-carousel-mq-768="images/img-desktop-6.png"
data-carousel-mq-414="images/img-tablet-6.png"
alt="Image 6">
</div>
<!-- /End item -->
</div>
</div>
<!-- /End Carousel -->
</div></code></pre></div>
<div aria-labelledby='tab-css-1'
id='tab-view-css-1'
role='tabpanel' aria-hidden='true'><pre><code class='css'>/* scss */
.outer-jsc {
position: relative;
height: 450px;
border: 1px solid #fff;
margin: 0 auto;
min-height: 180px;
max-height: 450px;
height: 40vw;
background-color: #ddddd5;
h3 { font-size: 1.6rem; }
p { font-size: 1.2rem; }
@media screen and (min-width: 768px) {
h3 { font-size: 2.4rem; }
p { font-size: 1.6rem; }
}
}</code></pre></div>
</div>
</div>
<!-- catch(css) -->
<style type="text/x-example">
/* scss */
.outer-jsc {
position: relative;
height: 450px;
border: 1px solid #fff;
margin: 0 auto;
min-height: 180px;
max-height: 450px;
height: 40vw;
background-color: #ddddd5;
h3 { font-size: 1.6rem; }
p { font-size: 1.2rem; }
@media screen and (min-width: 768px) {
h3 { font-size: 2.4rem; }
p { font-size: 1.6rem; }
}
}
</style>
<!-- endcatch -->
<div class="container p2">
<div class="site-width">
<h2>Variable width, height and font size</h2>
<p>Various dynamic metrics with some media directives.</p>
<ul role='tablist'>
<li class='active'>
<button id='tab-example-2' role='tab'
aria-controls='tab-view-example-2'
aria-selected='true'>Example</button>
</li>
<li>
<button id='tab-code-2' role='tab'
aria-controls='tab-view-code-2'
aria-selected='false'>HTML</button>
</li>
<li>
<button id='tab-css-2' role='tab'
aria-controls='tab-view-css-2'
aria-selected='false'>CSS</button>
</li></ul>
<div aria-labelledby='tab-example-2'
id='tab-view-example-2'
role='tabpanel' aria-hidden='false'>
<!-- catch(source) -->
<div class="outer-jsc">
<div class="carousel"
data-carousel-delay="3000"
data-carousel-rubberband-swipe="2">
<div class="carousel-slider">
<div class="carousel-item">
<div class="carousel-item-text">
<h3>Header for the first item</h3>
<p>This is text for the first item</p>
</div>
<img src="images/transparent-pixel.gif"
data-carousel-src="images/img-desktop-1.png"
alt="Image 1">
</div>
<div class="carousel-item">
<div class="carousel-item-text">
<h3>Header for the second item</h3>
<p>This is text for the second item</p>
</div>
<img src="images/transparent-pixel.gif"
data-carousel-src="images/img-desktop-2.png"
alt="Image 2">
</div>
<div class="carousel-item">
<div class="carousel-item-text">
<h3>Header for the third item</h3>
<p>This is text for the third item</p>
</div>
<img src="images/transparent-pixel.gif"
data-carousel-src="images/img-desktop-3.png"
alt="Image 3">
</div>
<div class="carousel-item">
<div class="carousel-item-text">
<h3>Header for the fourth item</h3>
<p>This is text for the fourth item</p>
</div>
<img src="images/transparent-pixel.gif"
data-carousel-src="images/img-desktop-4.png"
alt="Image 4">
</div>
</div>
</div>
</div>
<!-- endcatch -->
</div>
<div aria-labelledby='tab-code-2'
id='tab-view-code-2'
role='tabpanel' aria-hidden='true'><pre><code class='html'><div class="outer-jsc">
<div class="carousel"
data-carousel-delay="3000"
data-carousel-rubberband-swipe="2">
<div class="carousel-slider">
<div class="carousel-item">
<div class="carousel-item-text">
<h3>Header for the first item</h3>
<p>This is text for the first item</p>
</div>
<img src="images/transparent-pixel.gif"
data-carousel-src="images/img-desktop-1.png"
alt="Image 1">
</div>
<div class="carousel-item">
<div class="carousel-item-text">
<h3>Header for the second item</h3>
<p>This is text for the second item</p>
</div>
<img src="images/transparent-pixel.gif"
data-carousel-src="images/img-desktop-2.png"
alt="Image 2">
</div>
<div class="carousel-item">
<div class="carousel-item-text">
<h3>Header for the third item</h3>
<p>This is text for the third item</p>
</div>
<img src="images/transparent-pixel.gif"
data-carousel-src="images/img-desktop-3.png"
alt="Image 3">
</div>
<div class="carousel-item">
<div class="carousel-item-text">
<h3>Header for the fourth item</h3>
<p>This is text for the fourth item</p>
</div>
<img src="images/transparent-pixel.gif"
data-carousel-src="images/img-desktop-4.png"
alt="Image 4">
</div>
</div>
</div>
</div></code></pre></div>
<div aria-labelledby='tab-css-2'
id='tab-view-css-2'
role='tabpanel' aria-hidden='true'><pre><code class='css'>/* SCSS */
.outer-jsc {
position: relative;
border: 1px solid #fff;
margin: 0 auto;
width: 100%;
height: 50vw;
max-width: 900px;
max-height: 400px;
@media screen and (min-width: 768px) {
width: 50vw;
height: 30vw;
}
}
.carousel-item-text {
h3 { font-size: 1.8rem; }
p { font-size: 1.4rem; }
@media screen and (min-width: 767px) {
h3 { font-size: 2.4vw; }
p { font-size: 1.6vw; }
}
@media screen and (min-width: 1160px) {
h3 { font-size: 2.4rem; }
p { font-size: 1.6rem; }
}
}</code></pre></div>
</div>
</div>
<!-- catch(css) -->
<style type="text/x-example">
/* SCSS */
.outer-jsc {
position: relative;
border: 1px solid #fff;
margin: 0 auto;
width: 100%;
height: 50vw;
max-width: 900px;
max-height: 400px;
@media screen and (min-width: 768px) {
width: 50vw;
height: 30vw;
}
}
.carousel-item-text {
h3 { font-size: 1.8rem; }
p { font-size: 1.4rem; }
@media screen and (min-width: 767px) {
h3 { font-size: 2.4vw; }
p { font-size: 1.6vw; }
}
@media screen and (min-width: 1160px) {
h3 { font-size: 2.4rem; }
p { font-size: 1.6rem; }
}
}
</style>
<!-- endcatch -->
<div class="container p3">
<div class="site-width">
<h2>Max width, fixed height</h2>
<ul role='tablist'>
<li class='active'>
<button id='tab-example-3' role='tab'
aria-controls='tab-view-example-3'
aria-selected='true'>Example</button>
</li>
<li>
<button id='tab-code-3' role='tab'
aria-controls='tab-view-code-3'
aria-selected='false'>HTML</button>
</li>
<li>
<button id='tab-css-3' role='tab'
aria-controls='tab-view-css-3'
aria-selected='false'>CSS</button>
</li></ul>
<div aria-labelledby='tab-example-3'
id='tab-view-example-3'
role='tabpanel' aria-hidden='false'>
<!-- catch(source) -->
<div class="outer-jsc">
<div class="carousel" data-carousel-delay="8000">
<div class="carousel-slider">
<div class="carousel-item">
<div class="carousel-item-text">
<h3>Header for the first item</h3>
<p>This is text for the first item</p>
</div>
<img src="images/transparent-pixel.gif"
data-carousel-src="images/img-desktop-1.png"
alt="Image 1" />
</div>
<div class="carousel-item">
<div class="carousel-item-text">
<h3>Header for the second item</h3>
<p>This is text for the second item</p>
</div>
<img src="images/transparent-pixel.gif"
data-carousel-src="images/img-desktop-2.png"
alt="Image 2" />
</div>
<div class="carousel-item">
<div class="carousel-item-text">
<h3>Header for the third item</h3>
<p>This is text for the third item</p>
</div>
<img src="images/transparent-pixel.gif"
data-carousel-src="images/img-desktop-3.png"
alt="Image 3" />
</div>
<div class="carousel-item">
<div class="carousel-item-text">
<h3>Header for the fourth item</h3>
<p>This is text for the fourth item</p>
</div>
<img src="images/transparent-pixel.gif"
data-carousel-src="images/img-desktop-4.png"
alt="Image 4" />
</div>
</div>
</div>
</div>
<!-- endcatch -->
</div>
<div aria-labelledby='tab-code-3'
id='tab-view-code-3'
role='tabpanel' aria-hidden='true'><pre><code class='html'><div class="outer-jsc">
<div class="carousel" data-carousel-delay="8000">
<div class="carousel-slider">
<div class="carousel-item">
<div class="carousel-item-text">
<h3>Header for the first item</h3>
<p>This is text for the first item</p>
</div>
<img src="images/transparent-pixel.gif"
data-carousel-src="images/img-desktop-1.png"
alt="Image 1" />
</div>
<div class="carousel-item">
<div class="carousel-item-text">
<h3>Header for the second item</h3>
<p>This is text for the second item</p>
</div>
<img src="images/transparent-pixel.gif"
data-carousel-src="images/img-desktop-2.png"
alt="Image 2" />
</div>
<div class="carousel-item">
<div class="carousel-item-text">
<h3>Header for the third item</h3>
<p>This is text for the third item</p>
</div>
<img src="images/transparent-pixel.gif"
data-carousel-src="images/img-desktop-3.png"
alt="Image 3" />
</div>
<div class="carousel-item">
<div class="carousel-item-text">
<h3>Header for the fourth item</h3>
<p>This is text for the fourth item</p>
</div>
<img src="images/transparent-pixel.gif"
data-carousel-src="images/img-desktop-4.png"
alt="Image 4" />
</div>
</div>
</div>
</div></code></pre></div>
<div aria-labelledby='tab-css-3'
id='tab-view-css-3'
role='tabpanel' aria-hidden='true'><pre><code class='css'>.outer-jsc {
position: relative;
border: 1px solid #fff;
margin: 0 auto;
max-width: 720px;
height: 450px;
}</code></pre></div>
</div>
</div>
<!-- catch(css) -->
<style type="text/x-example">
.outer-jsc {
position: relative;
border: 1px solid #fff;
margin: 0 auto;
max-width: 720px;
height: 450px;
}
</style>
<!-- endcatch -->
<div class="container p4">
<div class="site-width">
<h2>Same as example 2 <small>but with static text</small></h2>
<p>Various dynamic metrics with some media directives.</p>
<ul role='tablist'>
<li class='active'>
<button id='tab-example-4' role='tab'
aria-controls='tab-view-example-4'
aria-selected='true'>Example</button>
</li>
<li>
<button id='tab-code-4' role='tab'
aria-controls='tab-view-code-4'
aria-selected='false'>HTML</button>
</li>
<li>
<button id='tab-css-4' role='tab'
aria-controls='tab-view-css-4'
aria-selected='false'>CSS</button>
</li></ul>
<div aria-labelledby='tab-example-4'
id='tab-view-example-4'
role='tabpanel' aria-hidden='false'>
<!-- catch(source) -->
<div class="outer-jsc">
<div class="carousel"
data-carousel-delay="6000"
data-carousel-indicators=""
data-carousel-rubberband-swipe="1.5">
<div class="carousel-static-text">
<h3>Static text</h3>
<p>This text should overlay all slider items.</p>
</div>
<div class="carousel-slider">
<div class="carousel-item" data-carousel-href="http://roxen.com">
<img src="images/transparent-pixel.gif"
data-carousel-src="images/img-desktop-1.png"
alt="Image 1">
</div>
<div class="carousel-item" data-carousel-href="http://download.roxen.com">
<img src="images/transparent-pixel.gif"
data-carousel-src="images/img-desktop-2.png"
alt="Image 2">
</div>
<div class="carousel-item">
<img src="images/transparent-pixel.gif"
data-carousel-src="images/img-desktop-3.png"
alt="Image 3">
</div>
<div class="carousel-item">
<img src="images/transparent-pixel.gif"
data-carousel-src="images/img-desktop-4.png"
alt="Image 4">
</div>
</div>
</div>
</div>
<!-- endcatch -->
</div>
<div aria-labelledby='tab-code-4'
id='tab-view-code-4'
role='tabpanel' aria-hidden='true'><pre><code class='html'><div class="outer-jsc">
<div class="carousel"
data-carousel-delay="6000"
data-carousel-indicators=""
data-carousel-rubberband-swipe="1.5">
<div class="carousel-static-text">
<h3>Static text</h3>
<p>This text should overlay all slider items.</p>
</div>
<div class="carousel-slider">
<div class="carousel-item" data-carousel-href="http://roxen.com">
<img src="images/transparent-pixel.gif"
data-carousel-src="images/img-desktop-1.png"
alt="Image 1">
</div>
<div class="carousel-item" data-carousel-href="http://download.roxen.com">
<img src="images/transparent-pixel.gif"
data-carousel-src="images/img-desktop-2.png"
alt="Image 2">
</div>
<div class="carousel-item">
<img src="images/transparent-pixel.gif"
data-carousel-src="images/img-desktop-3.png"
alt="Image 3">
</div>
<div class="carousel-item">
<img src="images/transparent-pixel.gif"
data-carousel-src="images/img-desktop-4.png"
alt="Image 4">
</div>
</div>
</div>
</div></code></pre></div>
<div aria-labelledby='tab-css-4'
id='tab-view-css-4'
role='tabpanel' aria-hidden='true'><pre><code class='css'>/* SCSS */
.outer-jsc {
position: relative;
border: 1px solid #fff;
margin: 0 auto;
width: 100%;
height: 50vw;
max-width: 900px;
max-height: 400px;
@media screen and (min-width: 768px) {
width: 50vw;
height: 30vw;
}
}
.carousel-item-text {
h3 { font-size: 1.8rem; }
p { font-size: 1.4rem; }
@media screen and (min-width: 767px) {
h3 { font-size: 2.4vw; }
p { font-size: 1.6vw; }
}
@media screen and (min-width: 1160px) {
h3 { font-size: 2.4rem; }
p { font-size: 1.6rem; }
}
}</code></pre></div>
</div>
</div>
<!-- catch(css) -->
<style type="text/x-example">
/* SCSS */
.outer-jsc {
position: relative;
border: 1px solid #fff;
margin: 0 auto;
width: 100%;
height: 50vw;
max-width: 900px;
max-height: 400px;
@media screen and (min-width: 768px) {
width: 50vw;
height: 30vw;
}
}
.carousel-item-text {
h3 { font-size: 1.8rem; }
p { font-size: 1.4rem; }
@media screen and (min-width: 767px) {
h3 { font-size: 2.4vw; }
p { font-size: 1.6vw; }
}
@media screen and (min-width: 1160px) {
h3 { font-size: 2.4rem; }
p { font-size: 1.6rem; }
}
}
</style>
<!-- endcatch -->
</body>
</html>