-
Notifications
You must be signed in to change notification settings - Fork 103
/
index.html
214 lines (214 loc) · 11.5 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
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width, initial-scale=1"><title>Slick-lightbox by mreq</title><link href="gh-pages/stylesheets/bootstrap.css" rel="stylesheet"><link href="gh-pages/stylesheets/bootstrap-theme.css" rel="stylesheet"><link href="gh-pages/stylesheets/tablesaw.stackonly.css" rel="stylesheet"><link href="gh-pages/stylesheets/tablesaw.stackonly.css" rel="stylesheet"><link href="gh-pages/stylesheets/github-highlight.css" rel="stylesheet"><style>.tablesaw-stack td .tablesaw-cell-label, .tablesaw-stack th .tablesaw-cell-label { overflow: hidden; text-overflow: ellipsis; }
h2 { margin-top: 30px; }
@media screen and (max-width: 770px) { .gh-ribbon { display: none; } }
</style><!--if lt IE 9script(src='https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js')
script(src='https://oss.maxcdn.com/respond/1.4.2/respond.min.js')--></head><body><nav class="navbar navbar-default"><div class="container-fluid"><div class="navbar-header"><button type="button" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" class="navbar-toggle collapsed"><span class="sr-only">Toggle navigation</span><span class="icon-bar"></span><span class="icon-bar"></span><span class="icon-bar"></span></button><a href="/slick-lightbox/" class="navbar-brand">Slick lightbox</a></div><div id="bs-example-navbar-collapse-1" class="collapse navbar-collapse"><ul class="nav navbar-nav"><li><a href="#usage">Usage</a></li><li><a href="#options">Options</a></li><li><a href="#events">Events</a></li><li><a href="docs/">Docs</a></li><li><a href="demo/">Demo</a></li></ul></div></div></nav><div class="container"><h1 id="slick-lightbox">slick-lightbox</h1>
<p><a href="https://cdnjs.com/libraries/slick-lightbox"><img src="https://img.shields.io/cdnjs/v/slick-lightbox.svg" alt="CDNJS"></a></p>
<p>A lightbox wrapper for Ken's amazing slick carousel. Credits go to <a href="https://github.com/kenwheeler">kenwheeler</a> for doing the <a href="https://github.com/kenwheeler/slick">hard work</a>.</p>
<h2 id="setup">Setup</h2>
<h3 id="bower">Bower</h3>
<pre><code>bower install -S slick-lightbox
</code></pre><h3 id="ruby-on-rails">Ruby on Rails</h3>
<p>Use the <a href="https://github.com/jwir3/slick-lightbox-rails">slick-lightbox-rails</a> gem. Add to Gemfile.</p>
<pre><code>gem 'slick-lightbox-rails', '>= 0.0.1'
</code></pre><p>Run bundler.</p>
<pre><code>bundle install
</code></pre><h2 id="usage">Usage</h2>
<p>Make sure you include CSS for both slick and slick-lightbox. Example HTML:</p>
<pre><code class="lang-html"><!DOCTYPE html>
<html>
<head>
<title>slick lightbox</title>
<meta name="viewport" content="width=device-width">
<link rel="stylesheet" type="text/css" href="bower_components/slick-carousel/slick/slick.css">
<link rel="stylesheet" type="text/css" href="bower_components/slick-carousel/slick/slick-theme.css">
<link rel="stylesheet" type="text/css" href="styles/slick-lightbox.css">
</head>
<body>
<div>
<ul>
<li><a href="http://placekitten.com/1600/1300" data-caption="Lorem ipsum 1600x1300">http://placekitten.com/1600/1300</a></li>
<li><a href="http://placekitten.com/1630/1280" data-caption="Lorem ipsum 1630x1280">http://placekitten.com/1630/1280</a></li>
<li><a href="http://placekitten.com/1500/1250" data-caption="Lorem ipsum 1500x1250">http://placekitten.com/1500/1250</a></li>
</ul>
</div>
<script type="text/javascript" src="bower_components/jquery/dist/jquery.js"></script>
<script type="text/javascript" src="bower_components/slick-carousel/slick/slick.min.js"></script>
<script type="text/javascript" src="scripts/slick-lightbox.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$('ul').slickLightbox({
itemSelector: '> li > a'
});
});
</script>
</body>
</html>
</code></pre>
<h2 id="options">Options</h2>
<table>
<thead>
<tr>
<th>Option</th>
<th>Type</th>
<th>Default</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>background</td>
<td>string</td>
<td><code>rgba(0,0,0,.8)</code></td>
<td>Background for the lightbox. Is used directly as a CSS <code>background</code> statement so that color and/or an image can be used.</td>
</tr>
<tr>
<td>closeOnEscape</td>
<td>boolean</td>
<td><code>true</code></td>
<td>Should the lightbox close upon pressing ESC?</td>
</tr>
<tr>
<td>closeOnBackdropClick</td>
<td>boolean</td>
<td><code>true</code></td>
<td>Should the lightbox close upon clicking on backdrop?</td>
</tr>
<tr>
<td>destroyTimeout</td>
<td>number</td>
<td><code>500</code></td>
<td>How many ms should we wait before actually removing the lightbox from the DOM? The default is used so that a 0.5s opacity transition can take place.</td>
</tr>
<tr>
<td>itemSelector</td>
<td>string</td>
<td><code>a</code></td>
<td>jQuery-like selector for the carousel-to-create items. The items should be anchors with <code>href</code> attribute aiming at the desired lightbox image. If that's not the case, you should specify the <code>src</code> option.</td>
</tr>
<tr>
<td>navigateByKeyboard</td>
<td>boolean</td>
<td><code>true</code></td>
<td>Can you use keyboard arrows to navigate the carousel?</td>
</tr>
<tr>
<td>slick</td>
<td>object</td>
<td><code>{}</code></td>
<td>Slick options to pass to the carousel.</td>
</tr>
<tr>
<td>caption</td>
<td>various</td>
<td><code>false</code></td>
<td>Should the images be captioned? If <code>false</code>, no caption is created. You can pass your own <strong>function</strong> accepting the <code>element</code> and <code>info</code> attributes (e.g. <code>function(element, info) { return $(element).doSomething(); }</code>, with <code>info</code> being an <code>{ index: itemIndex, length: itemCount }</code> object) or a <strong>string</strong> with the name of the <code>data-attribute</code> to be fetched (<code>my-caption</code> will get the value of <code>data-my-caption</code> attribute).</td>
</tr>
<tr>
<td>src</td>
<td>various</td>
<td><code>false</code></td>
<td>How to get the image urls? If <code>false</code>, no src is taken as the <code>href</code> attribute. You can pass your own <strong>function</strong> accepting the element as an attribute (e.g. <code>function(element) { return $(element).doSomething(); }</code>) or a <strong>string</strong> with the name of the attribute to be fetched (<code>src</code> will get the value of <code>element.src</code> attribute).</td>
</tr>
<tr>
<td>captionPosition</td>
<td>various</td>
<td><code>'dynamic'</code></td>
<td>Where should the caption be placed? When set to 'dynamic', the caption is displayed right under the image. When 'bottom', the caption is on the bottom of the screen independent to the image size.</td>
</tr>
<tr>
<td>images</td>
<td>various</td>
<td><code>false</code></td>
<td>When passed an array, slick lightbox doesn't scan the elements for image URLs and uses array's values instead.</td>
</tr>
<tr>
<td>useHistoryApi</td>
<td>boolean</td>
<td><code>false</code></td>
<td>When <code>true</code>, opening the lightbox does a <code>history.pushState</code>. The plugin then listens for the <code>popstate</code> event to close the lightbox.</td>
</tr>
<tr>
<td>layouts</td>
<td>object</td>
<td></td>
<td>See <a href="#layouts">Layouts</a></td>
</tr>
<tr>
<td>shouldOpen</td>
<td>function</td>
<td><code>null</code></td>
<td>Given a function, checks the return value before opening. If the function returns a falsy value, the lightbox is not opened upon clicking on the items. Accepts three arguments - the slick lightbox instance as the first, the clicked element as the second and the click event as the last.</td>
</tr>
<tr>
<td>imageMaxHeight</td>
<td>number</td>
<td><code>0.9</code></td>
<td>Maximum height of the lightbox images. Relative to the window height.</td>
</tr>
<tr>
<td>lazy</td>
<td>boolean</td>
<td><code>false</code></td>
<td>Should the images be lazyloaded? </td>
</tr>
<tr>
<td>lazyPlaceholder</td>
<td>string</td>
<td><code>null</code></td>
<td>Path to lazyloading placeholder. Defaults to a blank gif.</td>
</tr>
</tbody>
</table>
<h2 id="events">Events</h2>
<p>Events are triggered on the source element. Example:</p>
<pre><code class="lang-javascript">$(document).ready(function(){
$('ul').slickLightbox().on({
'show.slickLightbox': function(){ console.log('A `show.slickLightbox` event triggered.'); },1
'shown.slickLightbox': function(){ console.log('A `shown.slickLightbox` event triggered.'); },
'hide.slickLightbox': function(){ console.log('A `hide.slickLightbox` event triggered.'); },
'hidden.slickLightbox': function(){ console.log('A `hidden.slickLightbox` event triggered.'); }
});
});
</code></pre>
<table>
<thead>
<tr>
<th>Event</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>show.slickLightbox</td>
<td>Triggered when the lightbox is opened.</td>
</tr>
<tr>
<td>shown.slickLightbox</td>
<td>Triggered when the lightbox is opened, after the transitions took place.</td>
</tr>
<tr>
<td>hide.slickLightbox</td>
<td>Triggered when the lightbox is closed.</td>
</tr>
<tr>
<td>hidden.slickLightbox</td>
<td>Triggered when the lightbox is closed, after the transitions took place.</td>
</tr>
</tbody>
</table>
<h2 id="layouts">Layouts</h2>
<p>The layout is customizable using the <code>layouts</code> option object.</p>
<ul>
<li><code>layouts.closeButton</code>, which defaults to <code><button type="button" class="slick-lightbox-close"></button></code></li>
</ul>
<h2 id="lightbox-instance">Lightbox instance</h2>
<p>You can access the lightbox instance through the bound element. It's assigned to <code>.slickLightbox</code>. Example:</p>
<pre><code class="lang-javascript">$('#my-element').slickLightbox()
console.log('My slickLightbox instance:', $('#my-element')[0].slickLightbox)
// once a lightbox is opened
console.log('My slick instance:', $('#my-element')[0].slickLightbox.slick)
</code></pre>
<h2 id="contributing">Contributing</h2>
<p>Edit the coffee source please. Use gulp to build.</p>
</div><a href="https://github.com/mreq/slick-lightbox" class="gh-ribbon"><img style="position: absolute; top: 0; right: 0; border: 0;" src="https://camo.githubusercontent.com/38ef81f8aca64bb9a64448d0d70f1308ef5341ab/68747470733a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875622f726962626f6e732f666f726b6d655f72696768745f6461726b626c75655f3132313632312e706e67" alt="Fork me on GitHub" data-canonical-src="https://s3.amazonaws.com/github/ribbons/forkme_right_darkblue_121621.png"></a><script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script><script type="text/javascript">$('table').addClass('tablesaw tablesaw-stack').attr('data-tablesaw-mode', 'stack');</script><script src="gh-pages/javascripts/bootstrap.min.js"></script><script src="gh-pages/javascripts/tablesaw.stackonly.js"></script><script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/8.6/highlight.min.js"></script><script type="text/javascript">hljs.initHighlightingOnLoad();</script></body></html>