-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
378 lines (349 loc) · 9.58 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Crystal Slider</title>
<meta name="viewport" content="width=device-width,user-scalable=no">
<meta name="description" content="Crystal Slider - lightweight and simple slider written in vanilla JS">
<meta name="keywords" content="crystal, slider, carousel">
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto">
<link rel="stylesheet" href="assets/css/styles.css">
<link rel="stylesheet" href="dist/crystalslider.min.css">
</head>
<body>
<div class="page-wrapper">
<h1 class="page-wrapper__title">Crystal Slider</h1>
<div class="crystal-slider">
<div data-crystal-title="Slide description">
<img src="assets/img/slide-1.jpg" alt="">
</div>
<div data-crystal-title="Slide description 2">
<img src="assets/img/slide-2.jpg" alt="">
</div>
<div data-crystal-title="Slide description 3">
<img src="assets/img/slide-3.jpg" alt="">
</div>
<div data-crystal-title="Slide description 4">
<img src="assets/img/slide-4.jpg" alt="">
</div>
</div>
<div class="page-section">
<ul class="info-list">
<li class="info-list__item">
<a href="http:https://github.com/vadimbogomazov/CrystalSlider/archive/v1.1.0.zip" class="info-list__link">Download</a>
</li>
<li class="info-list__item">
<a href="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/vadimbogomazov/CrystalSlider" class="info-list__link">Github</a>
</li>
</ul>
<p>Readme languages: <a href="index.html">English</a>, <a href="index.ru.html">Русский</a></p>
<h2>Features</h2>
<ul>
<li>lightweight slider with minimum required functionality written in vanilla JS;</li>
<li>no dependencies;</li>
<li>responsive;</li>
<li>touch device support;</li>
<li>user-friendly;</li>
</ul>
<h2>More examples</h2>
<ul>
<li>
<a href="examples/multiple.html">Multiple slider instances</a>
</li>
<li>
<a href="examples/thumbnails.html">Slider with thumbnails navigation</a>
</li>
<li>
<a href="examples/autoplay.html">Autoplay</a>
</li>
<li>
<a href="examples/appendto.html">Append navigation/pagination to custom element</a>
</li>
</ul>
<h2>Installation</h2>
<p>Install via NPM:</p>
<pre><code>npm install crystalslider</code></pre>
<h3>Create HTML markup</h3>
<p>Create <code><div class="crystal-slider"></code> and <code><div></code> inside for each slide:</p>
<pre><code><div class="crystal-slider">
<div>
<img src="img/slide-1.jpg" alt="">
</div>
<div>
<img src="img/slide-2.jpg" alt="">
</div>
<div>
<img src="img/slide-3.jpg" alt="">
</div>
</div></code></pre>
<h3>Include plugin files</h3>
<p>Include <code>crystalslider.css</code> and <code>crystalslider.min.js</code>:</p>
<pre><code><link rel="stylesheet" href="css/crystalslider.css">
<script src="js/crystalslider.min.js"></script>
</code></pre>
<p>Slider css is divided into styles needed for correct plugin work, and styles of the basic theme (optional).</p>
<h3>Call plugin</h3>
<p>And the last step — calling plugin by specifying the required selector in options:</p>
<pre><code><script>
const crystalSlider = new CrystalSlider({
selector: 'your-selector' // .crystal-slider – default selector
});
</script></code></pre>
<h2>Options</h2>
<p>The slider plugin has the following options:</p>
<table>
<tr>
<th>Name</th>
<th>Description</th>
<th>Type</th>
<th>Default</th>
</tr>
<tr>
<td>selector</td>
<td>slider selector</td>
<td>String or DOM element</td>
<td>.crystal-slider</td>
</tr>
<tr>
<td>activeSlide</td>
<td>active slide index</td>
<td>Number</td>
<td>1</td>
</tr>
<tr>
<td>loop</td>
<td>slider loop</td>
<td>Boolean</td>
<td>true</td>
</tr>
<tr>
<td>autoplay</td>
<td>slider autoplay</td>
<td>Boolean</td>
<td>false</td>
</tr>
<tr>
<td>playInterval</td>
<td>play interval</td>
<td>Number</td>
<td>5000</td>
</tr>
<tr>
<td>pauseOnHover</td>
<td>pause on hover</td>
<td>Boolean</td>
<td>false</td>
</tr>
<tr>
<td>fade</td>
<td>fade mode</td>
<td>Boolean</td>
<td>false</td>
</tr>
<tr>
<td>duration</td>
<td>animation duration (in ms)</td>
<td>Number</td>
<td>500</td>
</tr>
<tr>
<td>draggable</td>
<td>slide dragging</td>
<td>Boolean</td>
<td>true</td>
</tr>
<tr>
<td>adaptiveHeight</td>
<td>adaptive height</td>
<td>Boolean</td>
<td>false</td>
</tr>
<tr>
<td>threshold</td>
<td>touch dragging threshold (in px)</td>
<td>Number</td>
<td>30</td>
</tr>
<tr>
<td>titles</td>
<td>slide titles (values are taken from the data-attributes of slides)</td>
<td>Boolean</td>
<td>false</td>
</tr>
<tr>
<td>keyboard</td>
<td>keyboard arrows ← →</td>
<td>Boolean</td>
<td>false</td>
</tr>
<tr>
<td>easing</td>
<td>easing function (<a href="http:https://easings.net/en" target="_blank">http:https://easings.net/en</a>)</td>
<td>String</td>
<td>ease-out</td>
</tr>
<tr>
<td>nav</td>
<td>navigation</td>
<td>Boolean</td>
<td>true</td>
</tr>
<tr>
<td>navPrevVal</td>
<td>previous button value</td>
<td>String</td>
<td>Prev</td>
</tr>
<tr>
<td>navNextVal</td>
<td>next button value</td>
<td>String</td>
<td>Next</td>
</tr>
<tr>
<td>appendNavTo</td>
<td>element where the navigation are attached</td>
<td>String or DOM element</td>
<td>null</td>
</tr>
<tr>
<td>pagination</td>
<td>pagination</td>
<td>Boolean</td>
<td>false</td>
</tr>
<tr>
<td>thumbnails</td>
<td>thumbnails (images are taken from the data-attributes of slides)</td>
<td>Boolean</td>
<td>false</td>
</tr>
<tr>
<td>appendPaginationTo</td>
<td>element where the pagination are attached</td>
<td>String or DOM element</td>
<td>null</td>
</tr>
<tr>
<td>zIndex</td>
<td>slide z-index (used in fade mode)</td>
<td>Number</td>
<td>98</td>
</tr>
<tr>
<td>onReady</td>
<td>callback after slider initiation</td>
<td>Function</td>
<td></td>
</tr>
<tr>
<td>beforeChange</td>
<td>callback before slide change</td>
<td>Function</td>
<td></td>
</tr>
<tr>
<td>afterChange</td>
<td>callback after slide change</td>
<td>Function</td>
<td></td>
</tr>
</table>
<h2>API</h2>
<h3>Methods</h3>
<table>
<tr>
<td>
prevSlide()
</td>
<td>
slides to the previous slide
</td>
</tr>
<tr>
<td>
nextSlide()
</td>
<td>
slides to the next slide
</td>
</tr>
<tr>
<td>
goToSlide(index)
</td>
<td>
slides to a slide with the set index (option {Number})
</td>
</tr>
<tr>
<td>
play()
</td>
<td>
start auto changing slides
</td>
</tr>
<tr>
<td>
stop()
</td>
<td>
stop auto changing slides
</td>
</tr>
<tr>
<td>
isEnabledOption(option)
</td>
<td>
returns true if the option is enable (option {String})
</td>
</tr>
<tr>
<td>
destroy()
</td>
<td>
destroy the slider instance
</td>
</tr>
<tr>
<td>
reinit(options)
</td>
<td>
slider reinit with new options (options {Object})
</td>
</tr>
</table>
<h3>Properties</h3>
<table>
<tr>
<td>
activeSlide
</td>
<td>
active slide index (read only)
</td>
</tr>
<tr>
<td>
slidesLength
</td>
<td>
number of slides (read only)
</td>
</tr>
</table>
<h2>Extra</h2>
<ul>
<li>Version: 1.1.0</li>
<li>License: MIT</li>
</ul>
</div>
</div>
<script src="dist/crystalslider.min.js"></script>
<script src="assets/js/scripts.js"></script>
</body>
</html>