Debian Codegraph @

doc/pasdoc/html-parts/castle-engine-website-base/node_modules/slick-carousel/README.markdown

raw
1 slick
2 -------
3
4 [1]: <https://github.com/kenwheeler/slick>
5
6 _the last carousel you'll ever need_
7
8 #### Demo
9
10 [http://kenwheeler.github.io/slick](http://kenwheeler.github.io/slick/)
11
12 #### CDN
13
14 To start working with Slick right away, there's a couple of CDN choices availabile
15 to serve the files as close, and fast as possible to your users:
16
17 - https://cdnjs.com/libraries/slick-carousel
18 - https://www.jsdelivr.com/projects/jquery.slick
19
20 ##### Example using jsDelivr
21
22 Just add a link to the css file in your `<head>`:
23
24 ```html
25 <!-- Add the slick-theme.css if you want default styling -->
26 <link rel="stylesheet" type="text/css" href="//cdn.jsdelivr.net/gh/kenwheeler/[email protected]/slick/slick.css"/>
27 <!-- Add the slick-theme.css if you want default styling -->
28 <link rel="stylesheet" type="text/css" href="//cdn.jsdelivr.net/gh/kenwheeler/[email protected]/slick/slick-theme.css"/>
29 ```
30
31 Then, before your closing ```<body>``` tag add:
32
33 ```html
34 <script type="text/javascript" src="//cdn.jsdelivr.net/gh/kenwheeler/[email protected]/slick/slick.min.js"></script>
35 ```
36
37 #### Package Managers
38
39 ```sh
40 # Bower
41 bower install --save slick-carousel
42
43 # NPM
44 npm install slick-carousel
45 ```
46
47 #### Contributing
48
49 PLEASE review CONTRIBUTING.markdown prior to requesting a feature, filing a pull request or filing an issue.
50
51 ### Data Attribute Settings
52
53 In slick 1.5 you can now add settings using the data-slick attribute. You still need to call $(element).slick() to initialize slick on the element.
54
55 Example:
56
57 ```html
58 <div data-slick='{"slidesToShow": 4, "slidesToScroll": 4}'>
59 <div><h3>1</h3></div>
60 <div><h3>2</h3></div>
61 <div><h3>3</h3></div>
62 <div><h3>4</h3></div>
63 <div><h3>5</h3></div>
64 <div><h3>6</h3></div>
65 </div>
66 ```
67
68 ### Settings
69
70 Option | Type | Default | Description
71 ------ | ---- | ------- | -----------
72 accessibility | boolean | true | Enables tabbing and arrow key navigation. Unless `autoplay: true`, sets browser focus to current slide (or first of current slide set, if multiple `slidesToShow`) after slide change. For full a11y compliance enable focusOnChange in addition to this.
73 adaptiveHeight | boolean | false | Adapts slider height to the current slide
74 appendArrows | string | $(element) | Change where the navigation arrows are attached (Selector, htmlString, Array, Element, jQuery object)
75 appendDots | string | $(element) | Change where the navigation dots are attached (Selector, htmlString, Array, Element, jQuery object)
76 arrows | boolean | true | Enable Next/Prev arrows
77 asNavFor | string | $(element) | Enables syncing of multiple sliders
78 autoplay | boolean | false | Enables auto play of slides
79 autoplaySpeed | int | 3000 | Auto play change interval
80 centerMode | boolean | false | Enables centered view with partial prev/next slides. Use with odd numbered slidesToShow counts.
81 centerPadding | string | '50px' | Side padding when in center mode. (px or %)
82 cssEase | string | 'ease' | CSS3 easing
83 customPaging | function | n/a | Custom paging templates. See source for use example.
84 dots | boolean | false | Current slide indicator dots
85 dotsClass | string | 'slick-dots' | Class for slide indicator dots container
86 draggable | boolean | true | Enables desktop dragging
87 easing | string | 'linear' | animate() fallback easing
88 edgeFriction | integer | 0.15 | Resistance when swiping edges of non-infinite carousels
89 fade | boolean | false | Enables fade
90 focusOnSelect | boolean | false | Enable focus on selected element (click)
91 focusOnChange | boolean | false | Puts focus on slide after change
92 infinite | boolean | true | Infinite looping
93 initialSlide | integer | 0 | Slide to start on
94 lazyLoad | string | 'ondemand' | Accepts 'ondemand' or 'progressive' for lazy load technique. 'ondemand' will load the image as soon as you slide to it, 'progressive' loads one image after the other when the page loads.
95 mobileFirst | boolean | false | Responsive settings use mobile first calculation
96 nextArrow | string (html \| jQuery selector) \| object (DOM node \| jQuery object) | `<button type="button" class="slick-next">Next</button>` | Allows you to select a node or customize the HTML for the "Next" arrow.
97 pauseOnDotsHover | boolean | false | Pauses autoplay when a dot is hovered
98 pauseOnFocus | boolean | true | Pauses autoplay when slider is focussed
99 pauseOnHover | boolean | true | Pauses autoplay on hover
100 prevArrow | string (html \| jQuery selector) \| object (DOM node \| jQuery object) | `<button type="button" class="slick-prev">Previous</button>` | Allows you to select a node or customize the HTML for the "Previous" arrow.
101 respondTo | string | 'window' | Width that responsive object responds to. Can be 'window', 'slider' or 'min' (the smaller of the two).
102 responsive | array | null | Array of objects [containing breakpoints and settings objects (see example)](#responsive-option-example). Enables settings at given `breakpoint`. Set `settings` to "unslick" instead of an object to disable slick at a given breakpoint.
103 rows | int | 1 | Setting this to more than 1 initializes grid mode. Use slidesPerRow to set how many slides should be in each row.
104 rtl | boolean | false | Change the slider's direction to become right-to-left
105 slide | string | '' | Slide element query
106 slidesPerRow | int | 1 | With grid mode initialized via the rows option, this sets how many slides are in each grid row.
107 slidesToScroll | int | 1 | # of slides to scroll at a time
108 slidesToShow | int | 1 | # of slides to show at a time
109 speed | int | 300 | Transition speed
110 swipe | boolean | true | Enables touch swipe
111 swipeToSlide | boolean | false | Swipe to slide irrespective of slidesToScroll
112 touchMove | boolean | true | Enables slide moving with touch
113 touchThreshold | int | 5 | To advance slides, the user must swipe a length of (1/touchThreshold) * the width of the slider.
114 useCSS | boolean | true | Enable/Disable CSS Transitions
115 useTransform | boolean | true | Enable/Disable CSS Transforms
116 variableWidth | boolean | false | Disables automatic slide width calculation
117 vertical | boolean | false | Vertical slide direction
118 verticalSwiping | boolean | false | Changes swipe direction to vertical
119 waitForAnimate | boolean | true | Ignores requests to advance the slide while animating
120 zIndex | number | 1000 | Set the zIndex values for slides, useful for IE9 and lower
121
122 ##### Responsive Option Example
123 The responsive option, and value, is quite unique and powerful.
124 You can use it like so:
125
126 ```javascript
127 $(".slider").slick({
128
129 // normal options...
130 infinite: false,
131
132 // the magic
133 responsive: [{
134
135 breakpoint: 1024,
136 settings: {
137 slidesToShow: 3,
138 infinite: true
139 }
140
141 }, {
142
143 breakpoint: 600,
144 settings: {
145 slidesToShow: 2,
146 dots: true
147 }
148
149 }, {
150
151 breakpoint: 300,
152 settings: "unslick" // destroys slick
153
154 }]
155 });
156 ```
157
158
159
160
161 ### Events
162
163 In slick 1.4, callback methods were deprecated and replaced with events. Use them before the initialization of slick as shown below:
164
165 ```javascript
166 // On swipe event
167 $('.your-element').on('swipe', function(event, slick, direction){
168 console.log(direction);
169 // left
170 });
171
172 // On edge hit
173 $('.your-element').on('edge', function(event, slick, direction){
174 console.log('edge was hit')
175 });
176
177 // On before slide change
178 $('.your-element').on('beforeChange', function(event, slick, currentSlide, nextSlide){
179 console.log(nextSlide);
180 });
181 ```
182
183 Event | Params | Description
184 ------ | -------- | -----------
185 afterChange | event, slick, currentSlide | After slide change callback
186 beforeChange | event, slick, currentSlide, nextSlide | Before slide change callback
187 breakpoint | event, slick, breakpoint | Fires after a breakpoint is hit
188 destroy | event, slick | When slider is destroyed, or unslicked.
189 edge | event, slick, direction | Fires when an edge is overscrolled in non-infinite mode.
190 init | event, slick | When Slick initializes for the first time callback. Note that this event should be defined before initializing the slider.
191 reInit | event, slick | Every time Slick (re-)initializes callback
192 setPosition | event, slick | Every time Slick recalculates position
193 swipe | event, slick, direction | Fires after swipe/drag
194 lazyLoaded | event, slick, image, imageSource | Fires after image loads lazily
195 lazyLoadError | event, slick, image, imageSource | Fires after image fails to load
196
197
198 #### Methods
199
200 Methods are called on slick instances through the slick method itself in version 1.4, see below:
201
202 ```javascript
203 // Add a slide
204 $('.your-element').slick('slickAdd',"<div></div>");
205
206 // Get the current slide
207 var currentSlide = $('.your-element').slick('slickCurrentSlide');
208 ```
209
210 This new syntax allows you to call any internal slick method as well:
211
212 ```javascript
213 // Manually refresh positioning of slick
214 $('.your-element').slick('setPosition');
215 ```
216
217
218 Method | Argument | Description
219 ------ | -------- | -----------
220 `slick` | options : object | Initializes Slick
221 `unslick` | | Destroys Slick
222 `slickNext` | | Triggers next slide
223 `slickPrev` | | Triggers previous slide
224 `slickPause` | | Pause Autoplay
225 `slickPlay` | | Start Autoplay (_will also set `autoplay` option to `true`_)
226 `slickGoTo` | index : int, dontAnimate : bool | Goes to slide by index, skipping animation if second parameter is set to true
227 `slickCurrentSlide` | | Returns the current slide index
228 `slickAdd` | element : html or DOM object, index: int, addBefore: bool | Add a slide. If an index is provided, will add at that index, or before if addBefore is set. If no index is provided, add to the end or to the beginning if addBefore is set. Accepts HTML String || Object
229 `slickRemove` | index: int, removeBefore: bool | Remove slide by index. If removeBefore is set true, remove slide preceding index, or the first slide if no index is specified. If removeBefore is set to false, remove the slide following index, or the last slide if no index is set.
230 `slickFilter` | filter : selector or function | Filters slides using jQuery .filter syntax
231 `slickUnfilter` | | Removes applied filter
232 `slickGetOption` | option : string(option name) | Gets an option value.
233 `slickSetOption` | change an option, `refresh` is always `boolean` and will update UI changes...
234 | `option, value, refresh` | change a [single `option`](https://github.com/kenwheeler/slick#settings) to given `value`; `refresh` is optional.
235 | `"responsive", [{ breakpoint: n, settings: {} }, ... ], refresh` | change or add [whole sets of responsive options](#responsive-option-example)
236 | `{ option: value, option: value, ... }, refresh` | change [multiple `option`s](https://github.com/kenwheeler/slick#settings) to corresponding `value`s.
237
238
239 #### Example
240
241 Initialize with:
242
243 ```javascript
244 $(element).slick({
245 dots: true,
246 speed: 500
247 });
248 ```
249
250 Change the speed with:
251
252 ```javascript
253 $(element).slick('slickSetOption', 'speed', 5000, true);
254 ```
255
256 Destroy with:
257
258 ```javascript
259 $(element).slick('unslick');
260 ```
261
262
263 #### Sass Variables
264
265 Variable | Type | Default | Description
266 ------ | ---- | ------- | -----------
267 $slick-font-path | string | "./fonts/" | Directory path for the slick icon font
268 $slick-font-family | string | "slick" | Font-family for slick icon font
269 $slick-loader-path | string | "./" | Directory path for the loader image
270 $slick-arrow-color | color | white | Color of the left/right arrow icons
271 $slick-dot-color | color | black | Color of the navigation dots
272 $slick-dot-color-active | color | $slick-dot-color | Color of the active navigation dot
273 $slick-prev-character | string | '\2190' | Unicode character code for the previous arrow icon
274 $slick-next-character | string | '\2192' | Unicode character code for the next arrow icon
275 $slick-dot-character | string | '\2022' | Unicode character code for the navigation dot icon
276 $slick-dot-size | pixels | 6px | Size of the navigation dots
277
278 #### Browser support
279
280 Slick works on IE8+ in addition to other modern browsers such as Chrome, Firefox, and Safari.
281
282 #### Dependencies
283
284 jQuery 1.7
285
286 #### License
287
288 Copyright (c) 2017 Ken Wheeler
289
290 Licensed under the MIT license.
291
292 Free as in Bacon.