jquery-slick-rails 1.3.6 → 1.3.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ddde7fd91d3d24bff24ad33987771d60b0f74593
4
- data.tar.gz: 5747b56eb8f7ad2178f3ee10ebca3f5e976d5d08
3
+ metadata.gz: 9555d9863b00347bbbfd4df4bd07eadefcb81823
4
+ data.tar.gz: 064c1bf51457ca7515d4515e8fa8d27143bd9a89
5
5
  SHA512:
6
- metadata.gz: b1099bb646c9c039fe927e9d13c6534be25621d36a46d295a71f897309d21a90a78bf1eaa726e7e148a3979a491a603637263b7cd13453d87e2192981d92431b
7
- data.tar.gz: 6436c0c0cb29c748fbc4c62c315e635b608ccd21573430e7885a9d43ef314a89e2ebea97a16d9556b7c95c894d5aa7bdb5c7e41c6116f23dd0566a1173001bb7
6
+ metadata.gz: f99d97538b03f3ec94c0b07d2aad66dfdde314692c8ef0ce0f9f3543393ead7334ddb77276adad11161e4017cd581d53e52902df4bebe56082978b29bf6f5c74
7
+ data.tar.gz: cac4de35e7b199b7dec8044546a62dd3d994441dbeb0f603481fa5d9c30978def35e5115c723d6f8eda58788edf1d52ed959e4c2d01b3dbf8c000b8823ecb44a
data/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # JquerySlickRails
2
2
 
3
+ [![Gem Version](https://badge.fury.io/rb/jquery-slick-rails.svg)](http://badge.fury.io/rb/jquery-slick-rails)
4
+
3
5
  A ruby gem that uses the Rails asset pipeline to include the jQuery Slick plugin by Ken Wheeler
4
6
  (https://kenwheeler.github.io/slick/).
5
7
 
@@ -31,4 +33,18 @@ and this line
31
33
 
32
34
  @import 'slick';
33
35
 
34
- into your `application.css.scss`.
36
+ into your `application.css.scss`.
37
+
38
+ ## Contributing
39
+
40
+ 1. Fork it
41
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
42
+ 3. Commit your changes (`git commit -am 'Added some feature'`)
43
+ 4. Push to the branch (`git push origin my-new-feature`)
44
+ 5. Create new Pull Request
45
+
46
+ ## License
47
+
48
+ This plugin is licensed under the [MIT License](https://github.com/bodrovis/jquery-slick-rails/blob/master/LICENSE.txt).
49
+
50
+ Copyright (c) 2014 [Ilya Bodrov](http://radiant-wind.com)
@@ -1,3 +1,3 @@
1
1
  module JquerySlickRails
2
- VERSION = "1.3.6"
2
+ VERSION = "1.3.7"
3
3
  end
@@ -1,1703 +1,1832 @@
1
1
  /*
2
- _ _ _ _
2
+ _ _ _ _
3
3
  ___| (_) ___| | __ (_)___
4
- / __| | |/ __| |/ / | / __|
5
- \__ \ | | (__| < _ | \__ \
6
- |___/_|_|\___|_|\_(_)/ |___/
7
- |__/
4
+ / __| | |/ __| |/ / | / __|
5
+ \__ \ | | (__| < _ | \__ \
6
+ |___/_|_|\___|_|\_(_)/ |___/
7
+ |__/
8
8
 
9
- Version: 1.3.6
10
- Author: Ken Wheeler
9
+ Version: 1.3.7
10
+ Author: Ken Wheeler
11
11
  Website: http://kenwheeler.github.io
12
- Docs: http://kenwheeler.github.io/slick
13
- Repo: http://github.com/kenwheeler/slick
14
- Issues: http://github.com/kenwheeler/slick/issues
12
+ Docs: http://kenwheeler.github.io/slick
13
+ Repo: http://github.com/kenwheeler/slick
14
+ Issues: http://github.com/kenwheeler/slick/issues
15
15
 
16
16
  */
17
17
 
18
18
  /* global window, document, define, jQuery, setInterval, clearInterval */
19
19
 
20
20
  (function(factory) {
21
- 'use strict';
22
- if (typeof define === 'function' && define.amd) {
23
- define(['jquery'], factory);
24
- } else {
25
- factory(jQuery);
26
- }
21
+ 'use strict';
22
+ if (typeof define === 'function' && define.amd) {
23
+ define(['jquery'], factory);
24
+ } else {
25
+ factory(jQuery);
26
+ }
27
27
 
28
28
  }(function($) {
29
- 'use strict';
30
- var Slick = window.Slick || {};
31
-
32
- Slick = (function() {
33
-
34
- var instanceUid = 0;
35
-
36
- function Slick(element, settings) {
37
-
38
- var _ = this,
39
- responsiveSettings, breakpoint;
40
-
41
- _.defaults = {
42
- accessibility: true,
43
- arrows: true,
44
- autoplay: false,
45
- autoplaySpeed: 3000,
46
- centerMode: false,
47
- centerPadding: '50px',
48
- cssEase: 'ease',
49
- customPaging: function(slider, i) {
50
- return '<button type="button">' + (i + 1) + '</button>';
51
- },
52
- dots: false,
53
- draggable: true,
54
- easing: 'linear',
55
- fade: false,
56
- infinite: true,
57
- lazyLoad: 'ondemand',
58
- onBeforeChange: null,
59
- onAfterChange: null,
60
- onInit: null,
61
- onReInit: null,
62
- pauseOnHover: true,
63
- responsive: null,
64
- slide: 'div',
65
- slidesToShow: 1,
66
- slidesToScroll: 1,
67
- speed: 300,
68
- swipe: true,
69
- touchMove: true,
70
- touchThreshold: 5,
71
- useCSS: true,
72
- vertical: false
73
- };
74
-
75
- _.initials = {
76
- animating: false,
77
- autoPlayTimer: null,
78
- currentSlide: 0,
79
- currentLeft: null,
80
- direction: 1,
81
- $dots: null,
82
- listWidth: null,
83
- listHeight: null,
84
- loadIndex: 0,
85
- $nextArrow: null,
86
- $prevArrow: null,
87
- slideCount: null,
88
- slideWidth: null,
89
- $slideTrack: null,
90
- $slides: null,
91
- sliding: false,
92
- slideOffset: 0,
93
- swipeLeft: null,
94
- $list: null,
95
- touchObject: {},
96
- transformsEnabled: false
97
- };
98
-
99
- $.extend(_, _.initials);
100
-
101
- _.activeBreakpoint = null;
102
- _.animType = null;
103
- _.animProp = null;
104
- _.breakpoints = [];
105
- _.breakpointSettings = [];
106
- _.cssTransitions = false;
107
- _.paused = false;
108
- _.positionProp = null;
109
- _.$slider = $(element);
110
- _.$slidesCache = null;
111
- _.transformType = null;
112
- _.transitionType = null;
113
- _.windowWidth = 0;
114
- _.windowTimer = null;
115
-
116
- _.options = $.extend({}, _.defaults, settings);
117
-
118
- _.originalSettings = _.options;
119
- responsiveSettings = _.options.responsive || null;
120
-
121
- if (responsiveSettings && responsiveSettings.length > -1) {
122
- for (breakpoint in responsiveSettings) {
123
- if (responsiveSettings.hasOwnProperty(breakpoint)) {
124
- _.breakpoints.push(responsiveSettings[
125
- breakpoint].breakpoint);
126
- _.breakpointSettings[responsiveSettings[
127
- breakpoint].breakpoint] =
128
- responsiveSettings[breakpoint].settings;
129
- }
130
- }
131
- _.breakpoints.sort(function(a, b) {
132
- return b - a;
133
- });
134
- }
29
+ 'use strict';
30
+ var Slick = window.Slick || {};
31
+
32
+ Slick = (function() {
33
+
34
+ var instanceUid = 0;
35
+
36
+ function Slick(element, settings) {
37
+
38
+ var _ = this,
39
+ responsiveSettings, breakpoint;
40
+
41
+ _.defaults = {
42
+ accessibility: true,
43
+ appendArrows: $(element),
44
+ arrows: true,
45
+ asNavFor: null,
46
+ prevArrow: '<button type="button" data-role="none" class="slick-prev">Previous</button>',
47
+ nextArrow: '<button type="button" data-role="none" class="slick-next">Next</button>',
48
+ autoplay: false,
49
+ autoplaySpeed: 3000,
50
+ centerMode: false,
51
+ centerPadding: '50px',
52
+ cssEase: 'ease',
53
+ customPaging: function(slider, i) {
54
+ return '<button type="button" data-role="none">' + (i + 1) + '</button>';
55
+ },
56
+ dots: false,
57
+ dotsClass: 'slick-dots',
58
+ draggable: true,
59
+ easing: 'linear',
60
+ fade: false,
61
+ focusOnSelect: false,
62
+ infinite: true,
63
+ lazyLoad: 'ondemand',
64
+ onBeforeChange: null,
65
+ onAfterChange: null,
66
+ onInit: null,
67
+ onReInit: null,
68
+ pauseOnHover: true,
69
+ pauseOnDotsHover: false,
70
+ responsive: null,
71
+ rtl: false,
72
+ slide: 'div',
73
+ slidesToShow: 1,
74
+ slidesToScroll: 1,
75
+ speed: 300,
76
+ swipe: true,
77
+ touchMove: true,
78
+ touchThreshold: 5,
79
+ useCSS: true,
80
+ vertical: false
81
+ };
82
+
83
+ _.initials = {
84
+ animating: false,
85
+ dragging: false,
86
+ autoPlayTimer: null,
87
+ currentSlide: 0,
88
+ currentLeft: null,
89
+ direction: 1,
90
+ $dots: null,
91
+ listWidth: null,
92
+ listHeight: null,
93
+ loadIndex: 0,
94
+ $nextArrow: null,
95
+ $prevArrow: null,
96
+ slideCount: null,
97
+ slideWidth: null,
98
+ $slideTrack: null,
99
+ $slides: null,
100
+ sliding: false,
101
+ slideOffset: 0,
102
+ swipeLeft: null,
103
+ $list: null,
104
+ touchObject: {},
105
+ transformsEnabled: false
106
+ };
107
+
108
+ $.extend(_, _.initials);
109
+
110
+ _.activeBreakpoint = null;
111
+ _.animType = null;
112
+ _.animProp = null;
113
+ _.breakpoints = [];
114
+ _.breakpointSettings = [];
115
+ _.cssTransitions = false;
116
+ _.paused = false;
117
+ _.positionProp = null;
118
+ _.$slider = $(element);
119
+ _.$slidesCache = null;
120
+ _.transformType = null;
121
+ _.transitionType = null;
122
+ _.windowWidth = 0;
123
+ _.windowTimer = null;
124
+
125
+ _.options = $.extend({}, _.defaults, settings);
126
+
127
+ _.originalSettings = _.options;
128
+ responsiveSettings = _.options.responsive || null;
129
+
130
+ if (responsiveSettings && responsiveSettings.length > -1) {
131
+ for (breakpoint in responsiveSettings) {
132
+ if (responsiveSettings.hasOwnProperty(breakpoint)) {
133
+ _.breakpoints.push(responsiveSettings[
134
+ breakpoint].breakpoint);
135
+ _.breakpointSettings[responsiveSettings[
136
+ breakpoint].breakpoint] =
137
+ responsiveSettings[breakpoint].settings;
138
+ }
139
+ }
140
+ _.breakpoints.sort(function(a, b) {
141
+ return b - a;
142
+ });
143
+ }
135
144
 
136
- _.autoPlay = $.proxy(_.autoPlay, _);
137
- _.autoPlayClear = $.proxy(_.autoPlayClear, _);
138
- _.changeSlide = $.proxy(_.changeSlide, _);
139
- _.setPosition = $.proxy(_.setPosition, _);
140
- _.swipeHandler = $.proxy(_.swipeHandler, _);
141
- _.dragHandler = $.proxy(_.dragHandler, _);
142
- _.keyHandler = $.proxy(_.keyHandler, _);
143
- _.autoPlayIterator = $.proxy(_.autoPlayIterator, _);
145
+ _.autoPlay = $.proxy(_.autoPlay, _);
146
+ _.autoPlayClear = $.proxy(_.autoPlayClear, _);
147
+ _.changeSlide = $.proxy(_.changeSlide, _);
148
+ _.selectHandler = $.proxy(_.selectHandler, _);
149
+ _.setPosition = $.proxy(_.setPosition, _);
150
+ _.swipeHandler = $.proxy(_.swipeHandler, _);
151
+ _.dragHandler = $.proxy(_.dragHandler, _);
152
+ _.keyHandler = $.proxy(_.keyHandler, _);
153
+ _.autoPlayIterator = $.proxy(_.autoPlayIterator, _);
144
154
 
145
- _.instanceUid = instanceUid++;
155
+ _.instanceUid = instanceUid++;
146
156
 
147
- _.init();
157
+ // A simple way to check for HTML strings
158
+ // Strict HTML recognition (must start with <)
159
+ // Extracted from jQuery v1.11 source
160
+ _.htmlExpr = /^(?:\s*(<[\w\W]+>)[^>]*)$/;
148
161
 
149
- }
162
+ _.init();
150
163
 
151
- return Slick;
164
+ }
152
165
 
153
- }());
166
+ return Slick;
154
167
 
155
- Slick.prototype.addSlide = function(markup, index, addBefore) {
168
+ }());
156
169
 
157
- var _ = this;
170
+ Slick.prototype.addSlide = function(markup, index, addBefore) {
158
171
 
159
- if (typeof(index) === 'boolean') {
160
- addBefore = index;
161
- index = null;
162
- } else if (index < 0 || (index >= _.slideCount)) {
163
- return false;
164
- }
172
+ var _ = this;
165
173
 
166
- _.unload();
174
+ if (typeof(index) === 'boolean') {
175
+ addBefore = index;
176
+ index = null;
177
+ } else if (index < 0 || (index >= _.slideCount)) {
178
+ return false;
179
+ }
167
180
 
168
- if (typeof(index) === 'number') {
169
- if (index === 0 && _.$slides.length === 0) {
170
- $(markup).appendTo(_.$slideTrack);
171
- } else if (addBefore) {
172
- $(markup).insertBefore(_.$slides.eq(index));
173
- } else {
174
- $(markup).insertAfter(_.$slides.eq(index));
175
- }
176
- } else {
177
- if (addBefore === true) {
178
- $(markup).prependTo(_.$slideTrack);
179
- } else {
180
- $(markup).appendTo(_.$slideTrack);
181
- }
182
- }
181
+ _.unload();
182
+
183
+ if (typeof(index) === 'number') {
184
+ if (index === 0 && _.$slides.length === 0) {
185
+ $(markup).appendTo(_.$slideTrack);
186
+ } else if (addBefore) {
187
+ $(markup).insertBefore(_.$slides.eq(index));
188
+ } else {
189
+ $(markup).insertAfter(_.$slides.eq(index));
190
+ }
191
+ } else {
192
+ if (addBefore === true) {
193
+ $(markup).prependTo(_.$slideTrack);
194
+ } else {
195
+ $(markup).appendTo(_.$slideTrack);
196
+ }
197
+ }
183
198
 
184
- _.$slides = _.$slideTrack.children(this.options.slide);
199
+ _.$slides = _.$slideTrack.children(this.options.slide);
185
200
 
186
- _.$slideTrack.children(this.options.slide).remove();
201
+ _.$slideTrack.children(this.options.slide).detach();
187
202
 
188
- _.$slideTrack.append(_.$slides);
203
+ _.$slideTrack.append(_.$slides);
189
204
 
190
- _.$slidesCache = _.$slides;
205
+ _.$slides.each(function(index, element) {
206
+ $(element).attr("index",index);
207
+ });
191
208
 
192
- _.reinit();
209
+ _.$slidesCache = _.$slides;
193
210
 
194
- };
211
+ _.reinit();
195
212
 
196
- Slick.prototype.animateSlide = function(targetLeft,
197
- callback) {
213
+ };
198
214
 
199
- var animProps = {}, _ = this;
215
+ Slick.prototype.animateSlide = function(targetLeft, callback) {
216
+
217
+ var animProps = {}, _ = this;
218
+
219
+ if (_.options.rtl === true && _.options.vertical === false) {
220
+ targetLeft = -targetLeft;
221
+ }
222
+ if (_.transformsEnabled === false) {
223
+ if (_.options.vertical === false) {
224
+ _.$slideTrack.animate({
225
+ left: targetLeft
226
+ }, _.options.speed, _.options.easing, callback);
227
+ } else {
228
+ _.$slideTrack.animate({
229
+ top: targetLeft
230
+ }, _.options.speed, _.options.easing, callback);
231
+ }
232
+
233
+ } else {
200
234
 
201
- if (_.transformsEnabled === false) {
235
+ if (_.cssTransitions === false) {
236
+
237
+ $({
238
+ animStart: _.currentLeft
239
+ }).animate({
240
+ animStart: targetLeft
241
+ }, {
242
+ duration: _.options.speed,
243
+ easing: _.options.easing,
244
+ step: function(now) {
202
245
  if (_.options.vertical === false) {
203
- _.$slideTrack.animate({
204
- left: targetLeft
205
- }, _.options.speed, _.options.easing, callback);
246
+ animProps[_.animType] = 'translate(' +
247
+ now + 'px, 0px)';
248
+ _.$slideTrack.css(animProps);
206
249
  } else {
207
- _.$slideTrack.animate({
208
- top: targetLeft
209
- }, _.options.speed, _.options.easing, callback);
250
+ animProps[_.animType] = 'translate(0px,' +
251
+ now + 'px)';
252
+ _.$slideTrack.css(animProps);
253
+ }
254
+ },
255
+ complete: function() {
256
+ if (callback) {
257
+ callback.call();
210
258
  }
259
+ }
260
+ });
211
261
 
212
- } else {
262
+ } else {
213
263
 
214
- if (_.cssTransitions === false) {
215
-
216
- $({
217
- animStart: _.currentLeft
218
- }).animate({
219
- animStart: targetLeft
220
- }, {
221
- duration: _.options.speed,
222
- easing: _.options.easing,
223
- step: function(now) {
224
- if (_.options.vertical === false) {
225
- animProps[_.animType] = 'translate(' +
226
- now + 'px, 0px)';
227
- _.$slideTrack.css(animProps);
228
- } else {
229
- animProps[_.animType] = 'translate(0px,' +
230
- now + 'px)';
231
- _.$slideTrack.css(animProps);
232
- }
233
- },
234
- complete: function() {
235
- if (callback) {
236
- callback.call();
237
- }
238
- }
239
- });
264
+ _.applyTransition();
240
265
 
241
- } else {
266
+ if (_.options.vertical === false) {
267
+ animProps[_.animType] = 'translate3d(' + targetLeft + 'px, 0px, 0px)';
268
+ } else {
269
+ animProps[_.animType] = 'translate3d(0px,' + targetLeft + 'px, 0px)';
270
+ }
271
+ _.$slideTrack.css(animProps);
242
272
 
243
- _.applyTransition();
273
+ if (callback) {
274
+ setTimeout(function() {
244
275
 
245
- if (_.options.vertical === false) {
246
- animProps[_.animType] = 'translate3d(' + targetLeft + 'px, 0px, 0px)';
247
- } else {
248
- animProps[_.animType] = 'translate3d(0px,' + targetLeft + 'px, 0px)';
249
- }
250
- _.$slideTrack.css(animProps);
276
+ _.disableTransition();
251
277
 
252
- if (callback) {
253
- setTimeout(function() {
278
+ callback.call();
279
+ }, _.options.speed);
280
+ }
254
281
 
255
- _.disableTransition();
282
+ }
256
283
 
257
- callback.call();
258
- }, _.options.speed);
259
- }
284
+ }
260
285
 
261
- }
286
+ };
262
287
 
263
- }
288
+ Slick.prototype.applyTransition = function(slide) {
264
289
 
265
- };
290
+ var _ = this,
291
+ transition = {};
266
292
 
267
- Slick.prototype.applyTransition = function(slide) {
293
+ if (_.options.fade === false) {
294
+ transition[_.transitionType] = _.transformType + ' ' + _.options.speed + 'ms ' + _.options.cssEase;
295
+ } else {
296
+ transition[_.transitionType] = 'opacity ' + _.options.speed + 'ms ' + _.options.cssEase;
297
+ }
268
298
 
269
- var _ = this,
270
- transition = {};
299
+ if (_.options.fade === false) {
300
+ _.$slideTrack.css(transition);
301
+ } else {
302
+ _.$slides.eq(slide).css(transition);
303
+ }
271
304
 
272
- if (_.options.fade === false) {
273
- transition[_.transitionType] = _.transformType + ' ' + _.options.speed + 'ms ' + _.options.cssEase;
274
- } else {
275
- transition[_.transitionType] = 'opacity ' + _.options.speed + 'ms ' + _.options.cssEase;
276
- }
305
+ };
277
306
 
278
- if (_.options.fade === false) {
279
- _.$slideTrack.css(transition);
280
- } else {
281
- _.$slides.eq(slide).css(transition);
282
- }
307
+ Slick.prototype.autoPlay = function() {
283
308
 
284
- };
309
+ var _ = this;
285
310
 
286
- Slick.prototype.autoPlay = function() {
311
+ if (_.autoPlayTimer) {
312
+ clearInterval(_.autoPlayTimer);
313
+ }
287
314
 
288
- var _ = this;
315
+ if (_.slideCount > _.options.slidesToShow && _.paused !== true) {
316
+ _.autoPlayTimer = setInterval(_.autoPlayIterator,
317
+ _.options.autoplaySpeed);
318
+ }
289
319
 
290
- if (_.autoPlayTimer) {
291
- clearInterval(_.autoPlayTimer);
292
- }
320
+ };
293
321
 
294
- if (_.slideCount > _.options.slidesToShow && _.paused !== true) {
295
- _.autoPlayTimer = setInterval(_.autoPlayIterator,
296
- _.options.autoplaySpeed);
297
- }
322
+ Slick.prototype.autoPlayClear = function() {
298
323
 
299
- };
324
+ var _ = this;
300
325
 
301
- Slick.prototype.autoPlayClear = function() {
326
+ if (_.autoPlayTimer) {
327
+ clearInterval(_.autoPlayTimer);
328
+ }
302
329
 
303
- var _ = this;
330
+ };
304
331
 
305
- if (_.autoPlayTimer) {
306
- clearInterval(_.autoPlayTimer);
307
- }
332
+ Slick.prototype.autoPlayIterator = function() {
308
333
 
309
- };
334
+ var _ = this;
335
+ var asNavFor = _.options.asNavFor != null ? $(_.options.asNavFor).getSlick() : null;
310
336
 
311
- Slick.prototype.autoPlayIterator = function() {
337
+ if (_.options.infinite === false) {
312
338
 
313
- var _ = this;
339
+ if (_.direction === 1) {
314
340
 
315
- if (_.options.infinite === false) {
341
+ if ((_.currentSlide + 1) === _.slideCount -
342
+ 1) {
343
+ _.direction = 0;
344
+ }
316
345
 
317
- if (_.direction === 1) {
346
+ _.slideHandler(_.currentSlide + _.options.slidesToScroll);
347
+ if(asNavFor != null) asNavFor.slideHandler(asNavFor.currentSlide + asNavFor.options.slidesToScroll);
318
348
 
319
- if ((_.currentSlide + 1) === _.slideCount -
320
- 1) {
321
- _.direction = 0;
322
- }
349
+ } else {
323
350
 
324
- _.slideHandler(_.currentSlide + _.options
325
- .slidesToScroll);
351
+ if ((_.currentSlide - 1 === 0)) {
326
352
 
327
- } else {
353
+ _.direction = 1;
328
354
 
329
- if ((_.currentSlide - 1 === 0)) {
355
+ }
330
356
 
331
- _.direction = 1;
357
+ _.slideHandler(_.currentSlide - _.options.slidesToScroll);
358
+ if(asNavFor != null) asNavFor.slideHandler(asNavFor.currentSlide - asNavFor.options.slidesToScroll);
332
359
 
333
- }
360
+ }
334
361
 
335
- _.slideHandler(_.currentSlide - _.options
336
- .slidesToScroll);
362
+ } else {
337
363
 
338
- }
364
+ _.slideHandler(_.currentSlide + _.options.slidesToScroll);
365
+ if(asNavFor != null) asNavFor.slideHandler(asNavFor.currentSlide + asNavFor.options.slidesToScroll);
339
366
 
340
- } else {
367
+ }
341
368
 
342
- _.slideHandler(_.currentSlide + _.options.slidesToScroll);
369
+ };
343
370
 
344
- }
371
+ Slick.prototype.buildArrows = function() {
345
372
 
346
- };
373
+ var _ = this;
347
374
 
348
- Slick.prototype.buildArrows = function() {
375
+ if (_.options.arrows === true && _.slideCount > _.options.slidesToShow) {
349
376
 
350
- var _ = this;
377
+ _.$prevArrow = $(_.options.prevArrow);
378
+ _.$nextArrow = $(_.options.nextArrow);
351
379
 
352
- if (_.options.arrows === true && _.slideCount > _.options.slidesToShow) {
380
+ if (_.htmlExpr.test(_.options.prevArrow)) {
381
+ _.$prevArrow.appendTo(_.options.appendArrows);
382
+ }
353
383
 
354
- _.$prevArrow = $(
355
- '<button type="button" class="slick-prev">Previous</button>').appendTo(
356
- _.$slider);
357
- _.$nextArrow = $(
358
- '<button type="button" class="slick-next">Next</button>').appendTo(
359
- _.$slider);
384
+ if (_.htmlExpr.test(_.options.nextArrow)) {
385
+ _.$nextArrow.appendTo(_.options.appendArrows);
386
+ }
360
387
 
361
- if (_.options.infinite !== true) {
362
- _.$prevArrow.addClass('slick-disabled');
363
- }
388
+ if (_.options.infinite !== true) {
389
+ _.$prevArrow.addClass('slick-disabled');
390
+ }
364
391
 
365
- }
392
+ }
366
393
 
367
- };
394
+ };
368
395
 
369
- Slick.prototype.buildDots = function() {
396
+ Slick.prototype.buildDots = function() {
370
397
 
371
- var _ = this,
372
- i, dotString;
398
+ var _ = this,
399
+ i, dotString;
373
400
 
374
- if (_.options.dots === true && _.slideCount > _.options.slidesToShow) {
401
+ if (_.options.dots === true && _.slideCount > _.options.slidesToShow) {
375
402
 
376
- dotString = '<ul class="slick-dots">';
403
+ dotString = '<ul class="' + _.options.dotsClass + '">';
377
404
 
378
- for (i = 0; i <= _.getDotCount(); i += 1) {
379
- dotString += '<li>' + _.options.customPaging.call(this, _, i) + '</li>';
380
- }
405
+ for (i = 0; i <= _.getDotCount(); i += 1) {
406
+ dotString += '<li>' + _.options.customPaging.call(this, _, i) + '</li>';
407
+ }
381
408
 
382
- dotString += '</ul>';
409
+ dotString += '</ul>';
383
410
 
384
- _.$dots = $(dotString).appendTo(
385
- _.$slider);
411
+ _.$dots = $(dotString).appendTo(
412
+ _.$slider);
386
413
 
387
- _.$dots.find('li').first().addClass(
388
- 'slick-active');
414
+ _.$dots.find('li').first().addClass(
415
+ 'slick-active');
389
416
 
390
- }
417
+ }
391
418
 
392
- };
419
+ };
393
420
 
394
- Slick.prototype.buildOut = function() {
421
+ Slick.prototype.buildOut = function() {
395
422
 
396
- var _ = this;
423
+ var _ = this;
397
424
 
398
- _.$slides = _.$slider.children(_.options.slide +
425
+ _.$slides = _.$slider.children(_.options.slide +
399
426
  ':not(.slick-cloned)').addClass(
400
427
  'slick-slide');
401
- _.slideCount = _.$slides.length;
402
- _.$slidesCache = _.$slides;
428
+ _.slideCount = _.$slides.length;
403
429
 
404
- _.$slider.addClass('slick-slider');
430
+ _.$slides.each(function(index, element) {
431
+ $(element).attr("index",index);
432
+ });
405
433
 
406
- _.$slideTrack = (_.slideCount === 0) ?
407
- $('<div class="slick-track"/>').appendTo(_.$slider) :
408
- _.$slides.wrapAll('<div class="slick-track"/>').parent();
434
+ _.$slidesCache = _.$slides;
409
435
 
410
- _.$list = _.$slideTrack.wrap(
411
- '<div class="slick-list"/>').parent();
412
- _.$slideTrack.css('opacity', 0);
436
+ _.$slider.addClass('slick-slider');
413
437
 
414
- if (_.options.centerMode === true) {
415
- _.options.infinite = true;
416
- _.options.slidesToScroll = 1;
417
- if (_.options.slidesToShow % 2 === 0) {
418
- _.options.slidesToShow = 3;
419
- }
420
- }
438
+ _.$slideTrack = (_.slideCount === 0) ?
439
+ $('<div class="slick-track"/>').appendTo(_.$slider) :
440
+ _.$slides.wrapAll('<div class="slick-track"/>').parent();
421
441
 
422
- $('img[data-lazy]', _.$slider).not('[src]').addClass('slick-loading');
442
+ _.$list = _.$slideTrack.wrap(
443
+ '<div class="slick-list"/>').parent();
444
+ _.$slideTrack.css('opacity', 0);
423
445
 
424
- _.setupInfinite();
446
+ if (_.options.centerMode === true) {
447
+ _.options.slidesToScroll = 1;
448
+ if (_.options.slidesToShow % 2 === 0) {
449
+ _.options.slidesToShow = 3;
450
+ }
451
+ }
425
452
 
426
- _.buildArrows();
453
+ $('img[data-lazy]', _.$slider).not('[src]').addClass('slick-loading');
427
454
 
428
- _.buildDots();
455
+ _.setupInfinite();
429
456
 
430
- if (_.options.accessibility === true) {
431
- _.$list.prop('tabIndex', 0);
432
- }
457
+ _.buildArrows();
433
458
 
434
- _.setSlideClasses(typeof this.currentSlide === 'number' ? this.currentSlide : 0);
459
+ _.buildDots();
435
460
 
436
- if (_.options.draggable === true) {
437
- _.$list.addClass('draggable');
438
- }
461
+ _.updateDots();
439
462
 
440
- };
463
+ if (_.options.accessibility === true) {
464
+ _.$list.prop('tabIndex', 0);
465
+ }
441
466
 
442
- Slick.prototype.checkResponsive = function() {
467
+ _.setSlideClasses(typeof this.currentSlide === 'number' ? this.currentSlide : 0);
443
468
 
444
- var _ = this,
445
- breakpoint, targetBreakpoint;
469
+ if (_.options.draggable === true) {
470
+ _.$list.addClass('draggable');
471
+ }
446
472
 
447
- if (_.originalSettings.responsive && _.originalSettings
448
- .responsive.length > -1 && _.originalSettings.responsive !== null) {
473
+ };
449
474
 
450
- targetBreakpoint = null;
475
+ Slick.prototype.checkResponsive = function() {
451
476
 
452
- for (breakpoint in _.breakpoints) {
453
- if (_.breakpoints.hasOwnProperty(breakpoint)) {
454
- if ($(window).width() < _.breakpoints[
455
- breakpoint]) {
456
- targetBreakpoint = _.breakpoints[
457
- breakpoint];
458
- }
459
- }
460
- }
477
+ var _ = this,
478
+ breakpoint, targetBreakpoint;
461
479
 
462
- if (targetBreakpoint !== null) {
463
- if (_.activeBreakpoint !== null) {
464
- if (targetBreakpoint !== _.activeBreakpoint) {
465
- _.activeBreakpoint =
466
- targetBreakpoint;
467
- _.options = $.extend({}, _.defaults,
468
- _.breakpointSettings[
469
- targetBreakpoint]);
470
- _.refresh();
471
- }
472
- } else {
473
- _.activeBreakpoint = targetBreakpoint;
474
- _.options = $.extend({}, _.defaults,
475
- _.breakpointSettings[
476
- targetBreakpoint]);
477
- _.refresh();
478
- }
479
- } else {
480
- if (_.activeBreakpoint !== null) {
481
- _.activeBreakpoint = null;
482
- _.options = $.extend({}, _.defaults,
483
- _.originalSettings);
484
- _.refresh();
485
- }
486
- }
480
+ if (_.originalSettings.responsive && _.originalSettings
481
+ .responsive.length > -1 && _.originalSettings.responsive !== null) {
482
+
483
+ targetBreakpoint = null;
487
484
 
485
+ for (breakpoint in _.breakpoints) {
486
+ if (_.breakpoints.hasOwnProperty(breakpoint)) {
487
+ if ($(window).width() < _.breakpoints[
488
+ breakpoint]) {
489
+ targetBreakpoint = _.breakpoints[
490
+ breakpoint];
491
+ }
488
492
  }
493
+ }
489
494
 
490
- };
495
+ if (targetBreakpoint !== null) {
496
+ if (_.activeBreakpoint !== null) {
497
+ if (targetBreakpoint !== _.activeBreakpoint) {
498
+ _.activeBreakpoint =
499
+ targetBreakpoint;
500
+ _.options = $.extend({}, _.options,
501
+ _.breakpointSettings[
502
+ targetBreakpoint]);
503
+ _.refresh();
504
+ }
505
+ } else {
506
+ _.activeBreakpoint = targetBreakpoint;
507
+ _.options = $.extend({}, _.options,
508
+ _.breakpointSettings[
509
+ targetBreakpoint]);
510
+ _.refresh();
511
+ }
512
+ } else {
513
+ if (_.activeBreakpoint !== null) {
514
+ _.activeBreakpoint = null;
515
+ _.options = $.extend({}, _.options,
516
+ _.originalSettings);
517
+ _.refresh();
518
+ }
519
+ }
520
+
521
+ }
491
522
 
492
- Slick.prototype.changeSlide = function(event) {
523
+ };
493
524
 
494
- var _ = this;
525
+ Slick.prototype.changeSlide = function(event) {
495
526
 
496
- switch (event.data.message) {
527
+ var _ = this,
528
+ $target = $(event.target);
529
+ var asNavFor = _.options.asNavFor != null ? $(_.options.asNavFor).getSlick() : null;
497
530
 
498
- case 'previous':
499
- _.slideHandler(_.currentSlide - _.options
500
- .slidesToScroll);
501
- break;
531
+ // If target is a link, prevent default action.
532
+ $target.is('a') && event.preventDefault();
502
533
 
503
- case 'next':
504
- _.slideHandler(_.currentSlide + _.options
505
- .slidesToScroll);
506
- break;
534
+ switch (event.data.message) {
507
535
 
508
- case 'index':
509
- _.slideHandler($(event.target).parent().index() * _.options.slidesToScroll);
510
- break;
536
+ case 'previous':
537
+ if (_.slideCount > _.options.slidesToShow) {
538
+ _.slideHandler(_.currentSlide - _.options
539
+ .slidesToScroll);
540
+ if(asNavFor != null) asNavFor.slideHandler(asNavFor.currentSlide - asNavFor.options.slidesToScroll);
541
+ }
542
+ break;
511
543
 
512
- default:
513
- return false;
544
+ case 'next':
545
+ if (_.slideCount > _.options.slidesToShow) {
546
+ _.slideHandler(_.currentSlide + _.options
547
+ .slidesToScroll);
548
+ if(asNavFor != null) asNavFor.slideHandler(asNavFor.currentSlide + asNavFor.options.slidesToScroll);
514
549
  }
550
+ break;
515
551
 
516
- };
552
+ case 'index':
553
+ var index = $(event.target).parent().index() * _.options.slidesToScroll;
554
+ _.slideHandler(index);
555
+ if(asNavFor != null) asNavFor.slideHandler(index); break;
517
556
 
518
- Slick.prototype.destroy = function() {
557
+ default:
558
+ return false;
559
+ }
519
560
 
520
- var _ = this;
561
+ };
521
562
 
522
- _.autoPlayClear();
563
+ Slick.prototype.destroy = function() {
523
564
 
524
- _.touchObject = {};
565
+ var _ = this;
525
566
 
526
- $('.slick-cloned', _.$slider).remove();
527
- if (_.$dots) {
528
- _.$dots.remove();
529
- }
530
- if (_.$prevArrow) {
531
- _.$prevArrow.remove();
532
- _.$nextArrow.remove();
533
- }
534
- _.$slides.unwrap().unwrap();
535
- _.$slides.removeClass(
536
- 'slick-slide slick-active slick-visible').removeAttr('style');
537
- _.$slider.removeClass('slick-slider');
538
- _.$slider.removeClass('slick-initialized');
567
+ _.autoPlayClear();
539
568
 
540
- _.$list.off('.slick');
541
- $(window).off('.slick-' + _.instanceUid);
542
- };
569
+ _.touchObject = {};
543
570
 
544
- Slick.prototype.disableTransition = function(slide) {
571
+ $('.slick-cloned', _.$slider).remove();
572
+ if (_.$dots) {
573
+ _.$dots.remove();
574
+ }
575
+ if (_.$prevArrow) {
576
+ _.$prevArrow.remove();
577
+ _.$nextArrow.remove();
578
+ }
579
+ if (_.$slides.parent().hasClass('slick-track')) {
580
+ _.$slides.unwrap().unwrap();
581
+ }
582
+ _.$slides.removeClass(
583
+ 'slick-slide slick-active slick-visible').removeAttr('style');
584
+ _.$slider.removeClass('slick-slider');
585
+ _.$slider.removeClass('slick-initialized');
545
586
 
546
- var _ = this,
547
- transition = {};
587
+ _.$list.off('.slick');
588
+ $(window).off('.slick-' + _.instanceUid);
589
+ $(document).off('.slick-' + _.instanceUid);
548
590
 
549
- transition[_.transitionType] = "";
591
+ };
550
592
 
551
- if (_.options.fade === false) {
552
- _.$slideTrack.css(transition);
553
- } else {
554
- _.$slides.eq(slide).css(transition);
555
- }
593
+ Slick.prototype.disableTransition = function(slide) {
556
594
 
557
- };
595
+ var _ = this,
596
+ transition = {};
558
597
 
559
- Slick.prototype.fadeSlide = function(slideIndex, callback) {
598
+ transition[_.transitionType] = "";
560
599
 
561
- var _ = this;
600
+ if (_.options.fade === false) {
601
+ _.$slideTrack.css(transition);
602
+ } else {
603
+ _.$slides.eq(slide).css(transition);
604
+ }
562
605
 
563
- if (_.cssTransitions === false) {
606
+ };
564
607
 
565
- _.$slides.eq(slideIndex).css({
566
- zIndex: 1000
567
- });
608
+ Slick.prototype.fadeSlide = function(slideIndex, callback) {
568
609
 
569
- _.$slides.eq(slideIndex).animate({
570
- opacity: 1
571
- }, _.options.speed, _.options.easing, callback);
610
+ var _ = this;
572
611
 
573
- } else {
612
+ if (_.cssTransitions === false) {
574
613
 
575
- _.applyTransition(slideIndex);
614
+ _.$slides.eq(slideIndex).css({
615
+ zIndex: 1000
616
+ });
576
617
 
577
- _.$slides.eq(slideIndex).css({
578
- opacity: 1,
579
- zIndex: 1000
580
- });
618
+ _.$slides.eq(slideIndex).animate({
619
+ opacity: 1
620
+ }, _.options.speed, _.options.easing, callback);
581
621
 
582
- if (callback) {
583
- setTimeout(function() {
622
+ } else {
584
623
 
585
- _.disableTransition(slideIndex);
624
+ _.applyTransition(slideIndex);
586
625
 
587
- callback.call();
588
- }, _.options.speed);
589
- }
626
+ _.$slides.eq(slideIndex).css({
627
+ opacity: 1,
628
+ zIndex: 1000
629
+ });
590
630
 
591
- }
631
+ if (callback) {
632
+ setTimeout(function() {
592
633
 
593
- };
634
+ _.disableTransition(slideIndex);
594
635
 
595
- Slick.prototype.filterSlides = function(filter) {
636
+ callback.call();
637
+ }, _.options.speed);
638
+ }
596
639
 
597
- var _ = this;
640
+ }
598
641
 
599
- if (filter !== null) {
642
+ };
600
643
 
601
- _.unload();
644
+ Slick.prototype.filterSlides = function(filter) {
602
645
 
603
- _.$slideTrack.children(this.options.slide).remove();
646
+ var _ = this;
604
647
 
605
- _.$slidesCache.filter(filter).appendTo(_.$slideTrack);
648
+ if (filter !== null) {
606
649
 
607
- _.reinit();
650
+ _.unload();
608
651
 
609
- }
652
+ _.$slideTrack.children(this.options.slide).detach();
610
653
 
611
- };
654
+ _.$slidesCache.filter(filter).appendTo(_.$slideTrack);
612
655
 
613
- Slick.prototype.getCurrent = function() {
656
+ _.reinit();
614
657
 
615
- var _ = this;
658
+ }
616
659
 
617
- return _.currentSlide;
660
+ };
618
661
 
619
- };
662
+ Slick.prototype.getCurrent = function() {
620
663
 
621
- Slick.prototype.getDotCount = function() {
664
+ var _ = this;
622
665
 
623
- var _ = this,
624
- breaker = 0,
625
- dotCounter = 0,
626
- dotCount = 0,
627
- dotLimit;
666
+ return _.currentSlide;
628
667
 
629
- dotLimit = _.options.infinite === true ? _.slideCount + _.options.slidesToShow - _.options.slidesToScroll : _.slideCount;
668
+ };
630
669
 
631
- while (breaker < dotLimit) {
632
- dotCount++;
633
- dotCounter += _.options.slidesToScroll;
634
- breaker = dotCounter + _.options.slidesToShow;
635
- }
670
+ Slick.prototype.getDotCount = function() {
636
671
 
637
- return dotCount;
672
+ var _ = this,
673
+ breaker = 0,
674
+ dotCounter = 0,
675
+ dotCount = 0,
676
+ dotLimit;
638
677
 
639
- };
678
+ dotLimit = _.options.infinite === true ? _.slideCount + _.options.slidesToShow - _.options.slidesToScroll : _.slideCount;
640
679
 
641
- Slick.prototype.getLeft = function(slideIndex) {
680
+ while (breaker < dotLimit) {
681
+ dotCount++;
682
+ dotCounter += _.options.slidesToScroll;
683
+ breaker = dotCounter + _.options.slidesToShow;
684
+ }
642
685
 
643
- var _ = this,
644
- targetLeft,
645
- verticalHeight,
646
- verticalOffset = 0;
686
+ return dotCount;
647
687
 
648
- _.slideOffset = 0;
649
- verticalHeight = _.$slides.first().outerHeight();
688
+ };
650
689
 
651
- if (_.options.infinite === true) {
652
- if (_.slideCount > _.options.slidesToShow) {
653
- _.slideOffset = (_.slideWidth * _.options.slidesToShow) * -1;
654
- verticalOffset = (verticalHeight * _.options.slidesToShow) * -1;
655
- }
656
- if (_.slideCount % _.options.slidesToScroll !== 0) {
657
- if (slideIndex + _.options.slidesToScroll > _.slideCount && _.slideCount > _.options.slidesToShow) {
658
- _.slideOffset = ((_.slideCount % _.options.slidesToShow) * _.slideWidth) * -1;
659
- verticalOffset = ((_.slideCount % _.options.slidesToShow) * verticalHeight) * -1;
660
- }
661
- }
662
- } else {
663
- if (_.slideCount % _.options.slidesToShow !== 0) {
664
- if (slideIndex + _.options.slidesToScroll > _.slideCount && _.slideCount > _.options.slidesToShow) {
665
- _.slideOffset = (_.options.slidesToShow * _.slideWidth) - ((_.slideCount % _.options.slidesToShow) * _.slideWidth);
666
- verticalOffset = ((_.slideCount % _.options.slidesToShow) * verticalHeight);
667
- }
668
- }
669
- }
690
+ Slick.prototype.getLeft = function(slideIndex) {
670
691
 
671
- if (_.options.centerMode === true) {
672
- _.slideOffset += _.slideWidth * Math.floor(_.options.slidesToShow / 2) - _.slideWidth;
673
- }
692
+ var _ = this,
693
+ targetLeft,
694
+ verticalHeight,
695
+ verticalOffset = 0;
674
696
 
675
- if (_.options.vertical === false) {
676
- targetLeft = ((slideIndex * _.slideWidth) * -1) + _.slideOffset;
677
- } else {
678
- targetLeft = ((slideIndex * verticalHeight) * -1) + verticalOffset;
697
+ _.slideOffset = 0;
698
+ verticalHeight = _.$slides.first().outerHeight();
699
+
700
+ if (_.options.infinite === true) {
701
+ if (_.slideCount > _.options.slidesToShow) {
702
+ _.slideOffset = (_.slideWidth * _.options.slidesToShow) * -1;
703
+ verticalOffset = (verticalHeight * _.options.slidesToShow) * -1;
704
+ }
705
+ if (_.slideCount % _.options.slidesToScroll !== 0) {
706
+ if (slideIndex + _.options.slidesToScroll > _.slideCount && _.slideCount > _.options.slidesToShow) {
707
+ _.slideOffset = ((_.slideCount % _.options.slidesToShow) * _.slideWidth) * -1;
708
+ verticalOffset = ((_.slideCount % _.options.slidesToShow) * verticalHeight) * -1;
679
709
  }
710
+ }
711
+ } else {
712
+ if (_.slideCount % _.options.slidesToShow !== 0) {
713
+ if (slideIndex + _.options.slidesToScroll > _.slideCount && _.slideCount > _.options.slidesToShow) {
714
+ _.slideOffset = (_.options.slidesToShow * _.slideWidth) - ((_.slideCount % _.options.slidesToShow) * _.slideWidth);
715
+ verticalOffset = ((_.slideCount % _.options.slidesToShow) * verticalHeight);
716
+ }
717
+ }
718
+ }
680
719
 
681
- return targetLeft;
720
+ if (_.options.centerMode === true && _.options.infinite === true) {
721
+ _.slideOffset += _.slideWidth * Math.floor(_.options.slidesToShow / 2) - _.slideWidth;
722
+ } else if (_.options.centerMode === true) {
723
+ _.slideOffset += _.slideWidth * Math.floor(_.options.slidesToShow / 2);
724
+ }
682
725
 
683
- };
726
+ if (_.options.vertical === false) {
727
+ targetLeft = ((slideIndex * _.slideWidth) * -1) + _.slideOffset;
728
+ } else {
729
+ targetLeft = ((slideIndex * verticalHeight) * -1) + verticalOffset;
730
+ }
684
731
 
685
- Slick.prototype.init = function() {
732
+ return targetLeft;
686
733
 
687
- var _ = this;
734
+ };
688
735
 
689
- if (!$(_.$slider).hasClass('slick-initialized')) {
736
+ Slick.prototype.init = function() {
690
737
 
691
- $(_.$slider).addClass('slick-initialized');
692
- _.buildOut();
693
- _.setProps();
694
- _.startLoad();
695
- _.loadSlider();
696
- _.initializeEvents();
697
- _.checkResponsive();
698
- }
738
+ var _ = this;
699
739
 
700
- if (_.options.onInit !== null) {
701
- _.options.onInit.call(this, _);
702
- }
740
+ if (!$(_.$slider).hasClass('slick-initialized')) {
703
741
 
704
- };
742
+ $(_.$slider).addClass('slick-initialized');
743
+ _.buildOut();
744
+ _.setProps();
745
+ _.startLoad();
746
+ _.loadSlider();
747
+ _.initializeEvents();
748
+ _.checkResponsive();
749
+ }
705
750
 
706
- Slick.prototype.initArrowEvents = function() {
751
+ if (_.options.onInit !== null) {
752
+ _.options.onInit.call(this, _);
753
+ }
707
754
 
708
- var _ = this;
755
+ };
709
756
 
710
- if (_.options.arrows === true && _.slideCount > _.options.slidesToShow) {
711
- _.$prevArrow.on('click.slick', {
712
- message: 'previous'
713
- }, _.changeSlide);
714
- _.$nextArrow.on('click.slick', {
715
- message: 'next'
716
- }, _.changeSlide);
717
- }
757
+ Slick.prototype.initArrowEvents = function() {
718
758
 
719
- };
759
+ var _ = this;
720
760
 
721
- Slick.prototype.initDotEvents = function() {
761
+ if (_.options.arrows === true && _.slideCount > _.options.slidesToShow) {
762
+ _.$prevArrow.on('click.slick', {
763
+ message: 'previous'
764
+ }, _.changeSlide);
765
+ _.$nextArrow.on('click.slick', {
766
+ message: 'next'
767
+ }, _.changeSlide);
768
+ }
722
769
 
723
- var _ = this;
770
+ };
724
771
 
725
- if (_.options.dots === true && _.slideCount > _.options.slidesToShow) {
726
- $('li', _.$dots).on('click.slick', {
727
- message: 'index'
728
- }, _.changeSlide);
729
- }
772
+ Slick.prototype.initDotEvents = function() {
730
773
 
731
- };
774
+ var _ = this;
732
775
 
733
- Slick.prototype.initializeEvents = function() {
776
+ if (_.options.dots === true && _.slideCount > _.options.slidesToShow) {
777
+ $('li', _.$dots).on('click.slick', {
778
+ message: 'index'
779
+ }, _.changeSlide);
780
+ }
734
781
 
735
- var _ = this;
782
+ if (_.options.dots === true && _.options.pauseOnDotsHover === true && _.options.autoplay === true) {
783
+ $('li', _.$dots)
784
+ .on('mouseenter.slick', _.autoPlayClear)
785
+ .on('mouseleave.slick', _.autoPlay);
786
+ }
736
787
 
737
- _.initArrowEvents();
788
+ };
738
789
 
739
- _.initDotEvents();
790
+ Slick.prototype.initializeEvents = function() {
740
791
 
741
- _.$list.on('touchstart.slick mousedown.slick', {
742
- action: 'start'
743
- }, _.swipeHandler);
744
- _.$list.on('touchmove.slick mousemove.slick', {
745
- action: 'move'
746
- }, _.swipeHandler);
747
- _.$list.on('touchend.slick mouseup.slick', {
748
- action: 'end'
749
- }, _.swipeHandler);
750
- _.$list.on('touchcancel.slick mouseleave.slick', {
751
- action: 'end'
752
- }, _.swipeHandler);
792
+ var _ = this;
753
793
 
754
- if (_.options.pauseOnHover === true && _.options.autoplay === true) {
755
- _.$list.on('mouseenter.slick', _.autoPlayClear);
756
- _.$list.on('mouseleave.slick', _.autoPlay);
757
- }
794
+ _.initArrowEvents();
758
795
 
759
- if(_.options.accessibility === true) {
760
- _.$list.on('keydown.slick', _.keyHandler);
761
- }
796
+ _.initDotEvents();
762
797
 
763
- $(window).on('orientationchange.slick.slick-' + _.instanceUid, function() {
764
- _.checkResponsive();
765
- _.setPosition();
766
- });
798
+ _.$list.on('touchstart.slick mousedown.slick', {
799
+ action: 'start'
800
+ }, _.swipeHandler);
801
+ _.$list.on('touchmove.slick mousemove.slick', {
802
+ action: 'move'
803
+ }, _.swipeHandler);
804
+ _.$list.on('touchend.slick mouseup.slick', {
805
+ action: 'end'
806
+ }, _.swipeHandler);
807
+ _.$list.on('touchcancel.slick mouseleave.slick', {
808
+ action: 'end'
809
+ }, _.swipeHandler);
767
810
 
768
- $(window).on('resize.slick.slick-' + _.instanceUid, function() {
769
- if ($(window).width !== _.windowWidth) {
770
- clearTimeout(_.windowDelay);
771
- _.windowDelay = window.setTimeout(function() {
772
- _.windowWidth = $(window).width();
773
- _.checkResponsive();
774
- _.setPosition();
775
- }, 50);
776
- }
777
- });
811
+ if (_.options.pauseOnHover === true && _.options.autoplay === true) {
812
+ _.$list.on('mouseenter.slick', _.autoPlayClear);
813
+ _.$list.on('mouseleave.slick', _.autoPlay);
814
+ }
778
815
 
779
- $(window).on('load.slick.slick-' + _.instanceUid, _.setPosition);
780
- $(document).on('ready.slick.slick-' + _.instanceUid, _.setPosition);
816
+ if(_.options.accessibility === true) {
817
+ _.$list.on('keydown.slick', _.keyHandler);
818
+ }
781
819
 
782
- };
820
+ if(_.options.focusOnSelect === true) {
821
+ $(_.options.slide, _.$slideTrack).on('click.slick', _.selectHandler);
822
+ }
783
823
 
784
- Slick.prototype.initUI = function() {
824
+ $(window).on('orientationchange.slick.slick-' + _.instanceUid, function() {
825
+ _.checkResponsive();
826
+ _.setPosition();
827
+ });
785
828
 
786
- var _ = this;
829
+ $(window).on('resize.slick.slick-' + _.instanceUid, function() {
830
+ if ($(window).width() !== _.windowWidth) {
831
+ clearTimeout(_.windowDelay);
832
+ _.windowDelay = window.setTimeout(function() {
833
+ _.windowWidth = $(window).width();
834
+ _.checkResponsive();
835
+ _.setPosition();
836
+ }, 50);
837
+ }
838
+ });
787
839
 
788
- if (_.options.arrows === true && _.slideCount > _.options.slidesToShow) {
840
+ $(window).on('load.slick.slick-' + _.instanceUid, _.setPosition);
841
+ $(document).on('ready.slick.slick-' + _.instanceUid, _.setPosition);
789
842
 
790
- _.$prevArrow.show();
791
- _.$nextArrow.show();
843
+ };
792
844
 
793
- }
845
+ Slick.prototype.initUI = function() {
794
846
 
795
- if (_.options.dots === true && _.slideCount > _.options.slidesToShow) {
847
+ var _ = this;
796
848
 
797
- _.$dots.show();
849
+ if (_.options.arrows === true && _.slideCount > _.options.slidesToShow) {
798
850
 
799
- }
851
+ _.$prevArrow.show();
852
+ _.$nextArrow.show();
800
853
 
801
- if (_.options.autoplay === true) {
854
+ }
802
855
 
803
- _.autoPlay();
856
+ if (_.options.dots === true && _.slideCount > _.options.slidesToShow) {
804
857
 
805
- }
858
+ _.$dots.show();
806
859
 
807
- };
860
+ }
808
861
 
809
- Slick.prototype.keyHandler = function(event) {
862
+ if (_.options.autoplay === true) {
810
863
 
811
- var _ = this;
864
+ _.autoPlay();
812
865
 
813
- if (event.keyCode === 37) {
814
- _.changeSlide({
815
- data: {
816
- message: 'previous'
817
- }
818
- });
819
- } else if (event.keyCode === 39) {
820
- _.changeSlide({
821
- data: {
822
- message: 'next'
823
- }
824
- });
825
- }
866
+ }
826
867
 
827
- };
868
+ };
828
869
 
829
- Slick.prototype.lazyLoad = function() {
870
+ Slick.prototype.keyHandler = function(event) {
830
871
 
831
- var _ = this,
832
- loadRange, cloneRange, rangeStart, rangeEnd;
872
+ var _ = this;
833
873
 
834
- if (_.options.centerMode === true || _.options.fade === true ) {
835
- rangeStart = _.options.slidesToShow + _.currentSlide - 1;
836
- rangeEnd = rangeStart + _.options.slidesToShow + 2;
837
- } else {
838
- rangeStart = _.options.infinite ? _.options.slidesToShow + _.currentSlide : _.currentSlide;
839
- rangeEnd = rangeStart + _.options.slidesToShow;
874
+ if (event.keyCode === 37) {
875
+ _.changeSlide({
876
+ data: {
877
+ message: 'previous'
840
878
  }
879
+ });
880
+ } else if (event.keyCode === 39) {
881
+ _.changeSlide({
882
+ data: {
883
+ message: 'next'
884
+ }
885
+ });
886
+ }
841
887
 
842
- loadRange = _.$slider.find('.slick-slide').slice(rangeStart, rangeEnd);
843
-
844
- $('img[data-lazy]', loadRange).not('[src]').each(function() {
845
- $(this).css({opacity: 0}).attr('src', $(this).attr('data-lazy')).removeClass('slick-loading').load(function(){
846
- $(this).animate({ opacity: 1 }, 200);
847
- });
848
- });
888
+ };
849
889
 
850
- if (_.currentSlide >= _.slideCount - _.options.slidesToShow) {
851
- cloneRange = _.$slider.find('.slick-cloned').slice(0, _.options.slidesToShow);
852
- $('img[data-lazy]', cloneRange).not('[src]').each(function() {
853
- $(this).css({opacity: 0}).attr('src', $(this).attr('data-lazy')).removeClass('slick-loading').load(function(){
854
- $(this).animate({ opacity: 1 }, 200);
855
- });
856
- });
857
- } else if (_.currentSlide === 0) {
858
- cloneRange = _.$slider.find('.slick-cloned').slice(_.options.slidesToShow * -1);
859
- $('img[data-lazy]', cloneRange).not('[src]').each(function() {
860
- $(this).css({opacity: 0}).attr('src', $(this).attr('data-lazy')).removeClass('slick-loading').load(function(){
861
- $(this).animate({ opacity: 1 }, 200);
862
- });
863
- });
864
- }
890
+ Slick.prototype.lazyLoad = function() {
865
891
 
866
- };
892
+ var _ = this,
893
+ loadRange, cloneRange, rangeStart, rangeEnd;
867
894
 
868
- Slick.prototype.loadSlider = function() {
895
+ function loadImages(imagesScope) {
896
+ $('img[data-lazy]', imagesScope).each(function() {
897
+ var image = $(this),
898
+ imageSource = $(this).attr('data-lazy') + "?" + new Date().getTime();
869
899
 
870
- var _ = this;
900
+ image
901
+ .load(function() { image.animate({ opacity: 1 }, 200); })
902
+ .css({ opacity: 0 })
903
+ .attr('src', imageSource)
904
+ .removeAttr('data-lazy')
905
+ .removeClass('slick-loading');
906
+ });
907
+ }
871
908
 
872
- _.setPosition();
909
+ if (_.options.centerMode === true || _.options.fade === true ) {
910
+ rangeStart = _.options.slidesToShow + _.currentSlide - 1;
911
+ rangeEnd = rangeStart + _.options.slidesToShow + 2;
912
+ } else {
913
+ rangeStart = _.options.infinite ? _.options.slidesToShow + _.currentSlide : _.currentSlide;
914
+ rangeEnd = rangeStart + _.options.slidesToShow;
915
+ }
873
916
 
874
- _.$slideTrack.css({
875
- opacity: 1
876
- });
917
+ loadRange = _.$slider.find('.slick-slide').slice(rangeStart, rangeEnd);
918
+ loadImages(loadRange);
919
+
920
+ if (_.slideCount == 1){
921
+ cloneRange = _.$slider.find('.slick-slide')
922
+ loadImages(cloneRange)
923
+ }else
924
+ if (_.currentSlide >= _.slideCount - _.options.slidesToShow) {
925
+ cloneRange = _.$slider.find('.slick-cloned').slice(0, _.options.slidesToShow);
926
+ loadImages(cloneRange)
927
+ } else if (_.currentSlide === 0) {
928
+ cloneRange = _.$slider.find('.slick-cloned').slice(_.options.slidesToShow * -1);
929
+ loadImages(cloneRange);
930
+ }
877
931
 
878
- _.$slider.removeClass('slick-loading');
932
+ };
879
933
 
880
- _.initUI();
934
+ Slick.prototype.loadSlider = function() {
881
935
 
882
- if (_.options.lazyLoad === 'progressive') {
883
- _.progressiveLazyLoad();
884
- }
936
+ var _ = this;
885
937
 
886
- };
938
+ _.setPosition();
887
939
 
888
- Slick.prototype.postSlide = function(index) {
940
+ _.$slideTrack.css({
941
+ opacity: 1
942
+ });
889
943
 
890
- var _ = this;
944
+ _.$slider.removeClass('slick-loading');
891
945
 
892
- if (_.options.onAfterChange !== null) {
893
- _.options.onAfterChange.call(this, _, index);
894
- }
946
+ _.initUI();
895
947
 
896
- _.animating = false;
948
+ if (_.options.lazyLoad === 'progressive') {
949
+ _.progressiveLazyLoad();
950
+ }
897
951
 
898
- _.setPosition();
952
+ };
899
953
 
900
- _.swipeLeft = null;
954
+ Slick.prototype.postSlide = function(index) {
901
955
 
902
- if (_.options.autoplay === true && _.paused === false) {
903
- _.autoPlay();
904
- }
956
+ var _ = this;
905
957
 
906
- };
958
+ if (_.options.onAfterChange !== null) {
959
+ _.options.onAfterChange.call(this, _, index);
960
+ }
907
961
 
908
- Slick.prototype.progressiveLazyLoad = function() {
962
+ _.animating = false;
909
963
 
910
- var _ = this,
911
- imgCount, targetImage;
964
+ _.setPosition();
912
965
 
913
- imgCount = $('img[data-lazy]').not('[src]').length;
966
+ _.swipeLeft = null;
914
967
 
915
- if (imgCount > 0) {
916
- targetImage = $($('img[data-lazy]', _.$slider).not('[src]').get(0));
917
- targetImage.attr('src', targetImage.attr('data-lazy')).removeClass('slick-loading').load(function() {
918
- _.progressiveLazyLoad();
919
- });
920
- }
968
+ if (_.options.autoplay === true && _.paused === false) {
969
+ _.autoPlay();
970
+ }
921
971
 
922
- };
972
+ };
923
973
 
924
- Slick.prototype.refresh = function() {
974
+ Slick.prototype.progressiveLazyLoad = function() {
925
975
 
926
- var _ = this,
927
- currentSlide = _.currentSlide;
976
+ var _ = this,
977
+ imgCount, targetImage;
928
978
 
929
- _.destroy();
979
+ imgCount = $('img[data-lazy]').length;
930
980
 
931
- $.extend(_, _.initials);
981
+ if (imgCount > 0) {
982
+ targetImage = $('img[data-lazy]', _.$slider).first();
983
+ targetImage.attr('src', targetImage.attr('data-lazy')).removeClass('slick-loading').load(function() {
984
+ targetImage.removeAttr('data-lazy');
985
+ _.progressiveLazyLoad();
986
+ });
987
+ }
932
988
 
933
- _.currentSlide = currentSlide;
934
- _.init();
989
+ };
935
990
 
936
- };
991
+ Slick.prototype.refresh = function() {
937
992
 
938
- Slick.prototype.reinit = function() {
993
+ var _ = this,
994
+ currentSlide = _.currentSlide;
939
995
 
940
- var _ = this;
996
+ _.destroy();
941
997
 
942
- _.$slides = _.$slideTrack.children(_.options.slide).addClass(
943
- 'slick-slide');
998
+ $.extend(_, _.initials);
944
999
 
945
- _.slideCount = _.$slides.length;
1000
+ _.currentSlide = currentSlide;
1001
+ _.init();
946
1002
 
947
- if (_.currentSlide >= _.slideCount && _.currentSlide !== 0) {
948
- _.currentSlide = _.currentSlide - _.options.slidesToScroll;
949
- }
1003
+ };
950
1004
 
951
- _.setProps();
1005
+ Slick.prototype.reinit = function() {
952
1006
 
953
- _.setupInfinite();
1007
+ var _ = this;
954
1008
 
955
- _.buildArrows();
1009
+ _.$slides = _.$slideTrack.children(_.options.slide).addClass(
1010
+ 'slick-slide');
956
1011
 
957
- _.updateArrows();
1012
+ _.slideCount = _.$slides.length;
958
1013
 
959
- _.initArrowEvents();
1014
+ if (_.currentSlide >= _.slideCount && _.currentSlide !== 0) {
1015
+ _.currentSlide = _.currentSlide - _.options.slidesToScroll;
1016
+ }
960
1017
 
961
- _.buildDots();
1018
+ _.setProps();
962
1019
 
963
- _.updateDots();
1020
+ _.setupInfinite();
964
1021
 
965
- _.initDotEvents();
1022
+ _.buildArrows();
966
1023
 
967
- _.setSlideClasses(0);
1024
+ _.updateArrows();
968
1025
 
969
- _.setPosition();
1026
+ _.initArrowEvents();
970
1027
 
971
- if (_.options.onReInit !== null) {
972
- _.options.onReInit.call(this, _);
973
- }
1028
+ _.buildDots();
974
1029
 
975
- };
1030
+ _.updateDots();
976
1031
 
977
- Slick.prototype.removeSlide = function(index, removeBefore) {
1032
+ _.initDotEvents();
978
1033
 
979
- var _ = this;
1034
+ if(_.options.focusOnSelect === true) {
1035
+ $(_.options.slide, _.$slideTrack).on('click.slick', _.selectHandler);
1036
+ }
980
1037
 
981
- if (typeof(index) === 'boolean') {
982
- removeBefore = index;
983
- index = removeBefore === true ? 0 : _.slideCount - 1;
984
- } else {
985
- index = removeBefore === true ? --index : index;
986
- }
1038
+ _.setSlideClasses(0);
987
1039
 
988
- if (_.slideCount < 1 || index < 0 || index > _.slideCount - 1) {
989
- return false;
990
- }
1040
+ _.setPosition();
991
1041
 
992
- _.unload();
1042
+ if (_.options.onReInit !== null) {
1043
+ _.options.onReInit.call(this, _);
1044
+ }
993
1045
 
994
- _.$slideTrack.children(this.options.slide).eq(index).remove();
1046
+ };
995
1047
 
996
- _.$slides = _.$slideTrack.children(this.options.slide);
1048
+ Slick.prototype.removeSlide = function(index, removeBefore) {
997
1049
 
998
- _.$slideTrack.children(this.options.slide).remove();
1050
+ var _ = this;
999
1051
 
1000
- _.$slideTrack.append(_.$slides);
1052
+ if (typeof(index) === 'boolean') {
1053
+ removeBefore = index;
1054
+ index = removeBefore === true ? 0 : _.slideCount - 1;
1055
+ } else {
1056
+ index = removeBefore === true ? --index : index;
1057
+ }
1001
1058
 
1002
- _.$slidesCache = _.$slides;
1059
+ if (_.slideCount < 1 || index < 0 || index > _.slideCount - 1) {
1060
+ return false;
1061
+ }
1003
1062
 
1004
- _.reinit();
1063
+ _.unload();
1005
1064
 
1006
- };
1065
+ _.$slideTrack.children(this.options.slide).eq(index).remove();
1007
1066
 
1008
- Slick.prototype.setCSS = function(position) {
1067
+ _.$slides = _.$slideTrack.children(this.options.slide);
1009
1068
 
1010
- var _ = this,
1011
- positionProps = {}, x, y;
1069
+ _.$slideTrack.children(this.options.slide).detach();
1012
1070
 
1013
- x = _.positionProp == 'left' ? position + 'px' : '0px';
1014
- y = _.positionProp == 'top' ? position + 'px' : '0px';
1071
+ _.$slideTrack.append(_.$slides);
1015
1072
 
1016
- positionProps[_.positionProp] = position;
1073
+ _.$slidesCache = _.$slides;
1017
1074
 
1018
- if (_.transformsEnabled === false) {
1019
- _.$slideTrack.css(positionProps);
1020
- } else {
1021
- positionProps = {};
1022
- if (_.cssTransitions === false) {
1023
- positionProps[_.animType] = 'translate(' + x + ', ' + y + ')';
1024
- _.$slideTrack.css(positionProps);
1025
- } else {
1026
- positionProps[_.animType] = 'translate3d(' + x + ', ' + y + ', 0px)';
1027
- _.$slideTrack.css(positionProps);
1028
- }
1029
- }
1075
+ _.reinit();
1030
1076
 
1031
- };
1077
+ };
1032
1078
 
1033
- Slick.prototype.setDimensions = function() {
1079
+ Slick.prototype.setCSS = function(position) {
1034
1080
 
1035
- var _ = this;
1081
+ var _ = this,
1082
+ positionProps = {}, x, y;
1036
1083
 
1037
- if (_.options.centerMode === true) {
1038
- _.$slideTrack.children('.slick-slide').width(_.slideWidth);
1039
- } else {
1040
- _.$slideTrack.children('.slick-slide').width(_.slideWidth);
1041
- }
1084
+ if (_.options.rtl === true) {
1085
+ position = -position;
1086
+ }
1087
+ x = _.positionProp == 'left' ? position + 'px' : '0px';
1088
+ y = _.positionProp == 'top' ? position + 'px' : '0px';
1042
1089
 
1090
+ positionProps[_.positionProp] = position;
1043
1091
 
1044
- if (_.options.vertical === false) {
1045
- _.$slideTrack.width(Math.ceil((_.slideWidth * _
1046
- .$slideTrack.children('.slick-slide').length)));
1047
- if (_.options.centerMode === true) {
1048
- _.$list.css({
1049
- padding: ('0px ' + _.options.centerPadding)
1050
- });
1051
- }
1052
- } else {
1053
- _.$list.height(_.$slides.first().outerHeight() * _.options.slidesToShow);
1054
- _.$slideTrack.height(Math.ceil((_.$slides.first().outerHeight() * _
1055
- .$slideTrack.children('.slick-slide').length)));
1056
- if (_.options.centerMode === true) {
1057
- _.$list.css({
1058
- padding: (_.options.centerPadding + ' 0px')
1059
- });
1060
- }
1061
- }
1092
+ if (_.transformsEnabled === false) {
1093
+ _.$slideTrack.css(positionProps);
1094
+ } else {
1095
+ positionProps = {};
1096
+ if (_.cssTransitions === false) {
1097
+ positionProps[_.animType] = 'translate(' + x + ', ' + y + ')';
1098
+ _.$slideTrack.css(positionProps);
1099
+ } else {
1100
+ positionProps[_.animType] = 'translate3d(' + x + ', ' + y + ', 0px)';
1101
+ _.$slideTrack.css(positionProps);
1102
+ }
1103
+ }
1062
1104
 
1063
- };
1105
+ };
1064
1106
 
1065
- Slick.prototype.setFade = function() {
1107
+ Slick.prototype.setDimensions = function() {
1066
1108
 
1067
- var _ = this,
1068
- targetLeft;
1109
+ var _ = this;
1069
1110
 
1070
- _.$slides.each(function(index, element) {
1071
- targetLeft = (_.slideWidth * index) * -1;
1072
- $(element).css({
1073
- position: 'relative',
1074
- left: targetLeft,
1075
- top: 0,
1076
- zIndex: 800,
1077
- opacity: 0
1078
- });
1111
+ if (_.options.vertical === false) {
1112
+ if (_.options.centerMode === true) {
1113
+ _.$list.css({
1114
+ padding: ('0px ' + _.options.centerPadding)
1079
1115
  });
1080
-
1081
- _.$slides.eq(_.currentSlide).css({
1082
- zIndex: 900,
1083
- opacity: 1
1116
+ }
1117
+ } else {
1118
+ _.$list.height(_.$slides.first().outerHeight(true) * _.options.slidesToShow);
1119
+ if (_.options.centerMode === true) {
1120
+ _.$list.css({
1121
+ padding: (_.options.centerPadding + ' 0px')
1084
1122
  });
1123
+ }
1124
+ }
1085
1125
 
1086
- };
1126
+ _.listWidth = _.$list.width();
1127
+ _.listHeight = _.$list.height();
1087
1128
 
1088
- Slick.prototype.setPosition = function() {
1089
1129
 
1090
- var _ = this;
1130
+ if(_.options.vertical === false) {
1131
+ _.slideWidth = Math.ceil(_.listWidth / _.options.slidesToShow);
1132
+ _.$slideTrack.width(Math.ceil((_.slideWidth * _.$slideTrack.children('.slick-slide').length)));
1091
1133
 
1092
- _.setValues();
1093
- _.setDimensions();
1134
+ } else {
1135
+ _.slideWidth = Math.ceil(_.listWidth);
1136
+ _.$slideTrack.height(Math.ceil((_.$slides.first().outerHeight(true) * _.$slideTrack.children('.slick-slide').length)));
1094
1137
 
1095
- if (_.options.fade === false) {
1096
- _.setCSS(_.getLeft(_.currentSlide));
1097
- } else {
1098
- _.setFade();
1099
- }
1138
+ }
1100
1139
 
1101
- };
1140
+ var offset = _.$slides.first().outerWidth(true) - _.$slides.first().width();
1141
+ _.$slideTrack.children('.slick-slide').width(_.slideWidth - offset);
1102
1142
 
1103
- Slick.prototype.setProps = function() {
1143
+ };
1104
1144
 
1105
- var _ = this;
1145
+ Slick.prototype.setFade = function() {
1106
1146
 
1107
- _.positionProp = _.options.vertical === true ? 'top' : 'left';
1147
+ var _ = this,
1148
+ targetLeft;
1108
1149
 
1109
- if (_.positionProp === 'top') {
1110
- _.$slider.addClass('slick-vertical');
1111
- } else {
1112
- _.$slider.removeClass('slick-vertical');
1113
- }
1150
+ _.$slides.each(function(index, element) {
1151
+ targetLeft = (_.slideWidth * index) * -1;
1152
+ $(element).css({
1153
+ position: 'relative',
1154
+ left: targetLeft,
1155
+ top: 0,
1156
+ zIndex: 800,
1157
+ opacity: 0
1158
+ });
1159
+ });
1114
1160
 
1115
- if (document.body.style.WebkitTransition !== undefined ||
1116
- document.body.style.MozTransition !== undefined ||
1117
- document.body.style.msTransition !== undefined) {
1118
- if(_.options.useCSS === true) {
1119
- _.cssTransitions = true;
1120
- }
1121
- }
1161
+ _.$slides.eq(_.currentSlide).css({
1162
+ zIndex: 900,
1163
+ opacity: 1
1164
+ });
1122
1165
 
1123
- if (document.body.style.MozTransform !== undefined) {
1124
- _.animType = 'MozTransform';
1125
- _.transformType = "-moz-transform";
1126
- _.transitionType = 'MozTransition';
1127
- }
1128
- if (document.body.style.webkitTransform !== undefined) {
1129
- _.animType = 'webkitTransform';
1130
- _.transformType = "-webkit-transform";
1131
- _.transitionType = 'webkitTransition';
1132
- }
1133
- if (document.body.style.msTransform !== undefined) {
1134
- _.animType = 'transform';
1135
- _.transformType = "transform";
1136
- _.transitionType = 'transition';
1137
- }
1166
+ };
1138
1167
 
1139
- _.transformsEnabled = (_.animType !== null);
1168
+ Slick.prototype.setPosition = function() {
1140
1169
 
1141
- };
1170
+ var _ = this;
1142
1171
 
1143
- Slick.prototype.setValues = function() {
1172
+ _.setDimensions();
1144
1173
 
1145
- var _ = this;
1174
+ if (_.options.fade === false) {
1175
+ _.setCSS(_.getLeft(_.currentSlide));
1176
+ } else {
1177
+ _.setFade();
1178
+ }
1146
1179
 
1147
- _.listWidth = _.$list.width();
1148
- _.listHeight = _.$list.height();
1149
- if(_.options.vertical === false) {
1150
- _.slideWidth = Math.ceil(_.listWidth / _.options
1151
- .slidesToShow);
1152
- } else {
1153
- _.slideWidth = Math.ceil(_.listWidth);
1154
- }
1180
+ };
1155
1181
 
1156
- };
1182
+ Slick.prototype.setProps = function() {
1157
1183
 
1158
- Slick.prototype.setSlideClasses = function(index) {
1184
+ var _ = this;
1159
1185
 
1160
- var _ = this,
1161
- centerOffset, allSlides, indexOffset;
1186
+ _.positionProp = _.options.vertical === true ? 'top' : 'left';
1162
1187
 
1163
- _.$slider.find('.slick-slide').removeClass('slick-active').removeClass('slick-center');
1164
- allSlides = _.$slider.find('.slick-slide');
1188
+ if (_.positionProp === 'top') {
1189
+ _.$slider.addClass('slick-vertical');
1190
+ } else {
1191
+ _.$slider.removeClass('slick-vertical');
1192
+ }
1165
1193
 
1166
- if (_.options.centerMode === true) {
1194
+ if (document.body.style.WebkitTransition !== undefined ||
1195
+ document.body.style.MozTransition !== undefined ||
1196
+ document.body.style.msTransition !== undefined) {
1197
+ if(_.options.useCSS === true) {
1198
+ _.cssTransitions = true;
1199
+ }
1200
+ }
1167
1201
 
1168
- centerOffset = Math.floor(_.options.slidesToShow / 2);
1202
+ if (document.body.style.MozTransform !== undefined) {
1203
+ _.animType = 'MozTransform';
1204
+ _.transformType = "-moz-transform";
1205
+ _.transitionType = 'MozTransition';
1206
+ }
1207
+ if (document.body.style.webkitTransform !== undefined) {
1208
+ _.animType = 'webkitTransform';
1209
+ _.transformType = "-webkit-transform";
1210
+ _.transitionType = 'webkitTransition';
1211
+ }
1212
+ if (document.body.style.msTransform !== undefined) {
1213
+ _.animType = 'msTransform';
1214
+ _.transformType = "-ms-transform";
1215
+ _.transitionType = 'msTransition';
1216
+ }
1217
+ if (document.body.style.transform !== undefined) {
1218
+ _.animType = 'transform';
1219
+ _.transformType = "transform";
1220
+ _.transitionType = 'transition';
1221
+ }
1169
1222
 
1170
- if (index >= centerOffset && index <= (_.slideCount - 1) - centerOffset) {
1171
- _.$slides.slice(index - centerOffset, index + centerOffset + 1).addClass('slick-active');
1172
- } else {
1173
- indexOffset = _.options.slidesToShow + index;
1174
- allSlides.slice(indexOffset - centerOffset + 1, indexOffset + centerOffset + 2).addClass('slick-active');
1175
- }
1223
+ _.transformsEnabled = (_.animType !== null);
1176
1224
 
1177
- if (index === 0) {
1178
- allSlides.eq(allSlides.length - 1 - _.options.slidesToShow).addClass('slick-center');
1179
- } else if (index === _.slideCount - 1) {
1180
- allSlides.eq(_.options.slidesToShow).addClass('slick-center');
1181
- }
1225
+ };
1182
1226
 
1183
- _.$slides.eq(index).addClass('slick-center');
1184
1227
 
1185
- } else {
1228
+ Slick.prototype.setSlideClasses = function(index) {
1186
1229
 
1187
- if (index > 0 && index < (_.slideCount - _.options.slidesToShow)) {
1188
- _.$slides.slice(index, index + _.options.slidesToShow).addClass('slick-active');
1189
- } else if ( allSlides.length <= _.options.slidesToShow ) {
1190
- allSlides.addClass('slick-active');
1191
- } else {
1192
- indexOffset = _.options.infinite === true ? _.options.slidesToShow + index : index;
1193
- allSlides.slice(indexOffset, indexOffset + _.options.slidesToShow).addClass('slick-active');
1194
- }
1230
+ var _ = this,
1231
+ centerOffset, allSlides, indexOffset, remainder;
1195
1232
 
1196
- }
1233
+ _.$slider.find('.slick-slide').removeClass('slick-active').removeClass('slick-center');
1234
+ allSlides = _.$slider.find('.slick-slide');
1197
1235
 
1198
- if (_.options.lazyLoad === 'ondemand') {
1199
- _.lazyLoad();
1200
- }
1236
+ if (_.options.centerMode === true) {
1201
1237
 
1202
- };
1238
+ centerOffset = Math.floor(_.options.slidesToShow / 2);
1203
1239
 
1204
- Slick.prototype.setupInfinite = function() {
1240
+ if(_.options.infinite === true) {
1205
1241
 
1206
- var _ = this,
1207
- i, slideIndex, infiniteCount;
1242
+ if (index >= centerOffset && index <= (_.slideCount - 1) - centerOffset) {
1243
+ _.$slides.slice(index - centerOffset, index + centerOffset + 1).addClass('slick-active');
1244
+ } else {
1245
+ indexOffset = _.options.slidesToShow + index;
1246
+ allSlides.slice(indexOffset - centerOffset + 1, indexOffset + centerOffset + 2).addClass('slick-active');
1247
+ }
1208
1248
 
1209
- if (_.options.fade === true || _.options.vertical === true) {
1210
- _.options.centerMode = false;
1249
+ if (index === 0) {
1250
+ allSlides.eq(allSlides.length - 1 - _.options.slidesToShow).addClass('slick-center');
1251
+ } else if (index === _.slideCount - 1) {
1252
+ allSlides.eq(_.options.slidesToShow).addClass('slick-center');
1211
1253
  }
1212
1254
 
1213
- if (_.options.infinite === true && _.options.fade === false) {
1214
-
1215
- slideIndex = null;
1216
-
1217
- if (_.slideCount > _.options.slidesToShow) {
1218
-
1219
- if (_.options.centerMode === true) {
1220
- infiniteCount = _.options.slidesToShow + 1;
1221
- } else {
1222
- infiniteCount = _.options.slidesToShow;
1223
- }
1224
-
1225
- for (i = _.slideCount; i > (_.slideCount -
1226
- infiniteCount); i -= 1) {
1227
- slideIndex = i - 1;
1228
- $(_.$slides[slideIndex]).clone().attr('id', '').prependTo(
1229
- _.$slideTrack).addClass('slick-cloned');
1230
- }
1231
- for (i = 0; i < infiniteCount; i += 1) {
1232
- slideIndex = i;
1233
- $(_.$slides[slideIndex]).clone().attr('id', '').appendTo(
1234
- _.$slideTrack).addClass('slick-cloned');
1235
- }
1236
- _.$slideTrack.find('.slick-cloned').find('[id]').each(function() {
1237
- $(this).attr('id', '');
1238
- });
1255
+ }
1239
1256
 
1240
- }
1257
+ _.$slides.eq(index).addClass('slick-center');
1258
+
1259
+ } else {
1241
1260
 
1261
+ if (index >= 0 && index <= (_.slideCount - _.options.slidesToShow)) {
1262
+ _.$slides.slice(index, index + _.options.slidesToShow).addClass('slick-active');
1263
+ } else if ( allSlides.length <= _.options.slidesToShow ) {
1264
+ allSlides.addClass('slick-active');
1265
+ } else {
1266
+ remainder = _.slideCount%_.options.slidesToShow;
1267
+ indexOffset = _.options.infinite === true ? _.options.slidesToShow + index : index;
1268
+ if(_.options.slidesToShow == _.options.slidesToScroll && (_.slideCount - index) < _.options.slidesToShow) {
1269
+ allSlides.slice(indexOffset-(_.options.slidesToShow-remainder), indexOffset + remainder).addClass('slick-active');
1270
+ } else {
1271
+ allSlides.slice(indexOffset, indexOffset + _.options.slidesToShow).addClass('slick-active');
1242
1272
  }
1273
+ }
1243
1274
 
1244
- };
1275
+ }
1245
1276
 
1246
- Slick.prototype.slideHandler = function(index) {
1277
+ if (_.options.lazyLoad === 'ondemand') {
1278
+ _.lazyLoad();
1279
+ }
1247
1280
 
1248
- var targetSlide, animSlide, slideLeft, unevenOffset, targetLeft = null,
1249
- _ = this;
1281
+ };
1250
1282
 
1251
- if (_.animating === true) {
1252
- return false;
1253
- }
1283
+ Slick.prototype.setupInfinite = function() {
1254
1284
 
1255
- targetSlide = index;
1256
- targetLeft = _.getLeft(targetSlide);
1257
- slideLeft = _.getLeft(_.currentSlide);
1285
+ var _ = this,
1286
+ i, slideIndex, infiniteCount;
1258
1287
 
1259
- unevenOffset = _.slideCount % _.options.slidesToScroll !== 0 ? _.options.slidesToScroll : 0;
1288
+ if (_.options.fade === true || _.options.vertical === true) {
1289
+ _.options.centerMode = false;
1290
+ }
1260
1291
 
1261
- _.currentLeft = _.swipeLeft === null ? slideLeft : _.swipeLeft;
1292
+ if (_.options.infinite === true && _.options.fade === false) {
1262
1293
 
1263
- if (_.options.infinite === false && (index < 0 || index > (_.slideCount - _.options.slidesToShow + unevenOffset))) {
1264
- if(_.options.fade === false) {
1265
- targetSlide = _.currentSlide;
1266
- _.animateSlide(slideLeft, function() {
1267
- _.postSlide(targetSlide);
1268
- });
1269
- }
1270
- return false;
1271
- }
1294
+ slideIndex = null;
1272
1295
 
1273
- if (_.options.autoplay === true) {
1274
- clearInterval(_.autoPlayTimer);
1275
- }
1296
+ if (_.slideCount > _.options.slidesToShow) {
1276
1297
 
1277
- if (targetSlide < 0) {
1278
- if (_.slideCount % _.options.slidesToScroll !== 0) {
1279
- animSlide = _.slideCount - (_.slideCount % _.options.slidesToScroll);
1280
- } else {
1281
- animSlide = _.slideCount - _.options.slidesToScroll;
1282
- }
1283
- } else if (targetSlide > (_.slideCount - 1)) {
1284
- animSlide = 0;
1298
+ if (_.options.centerMode === true) {
1299
+ infiniteCount = _.options.slidesToShow + 1;
1285
1300
  } else {
1286
- animSlide = targetSlide;
1301
+ infiniteCount = _.options.slidesToShow;
1287
1302
  }
1288
1303
 
1289
- _.animating = true;
1290
-
1291
- if (_.options.onBeforeChange !== null && index !== _.currentSlide) {
1292
- _.options.onBeforeChange.call(this, _, _.currentSlide, animSlide);
1304
+ for (i = _.slideCount; i > (_.slideCount -
1305
+ infiniteCount); i -= 1) {
1306
+ slideIndex = i - 1;
1307
+ $(_.$slides[slideIndex]).clone(true).attr('id', '').prependTo(
1308
+ _.$slideTrack).addClass('slick-cloned');
1309
+ }
1310
+ for (i = 0; i < infiniteCount; i += 1) {
1311
+ slideIndex = i;
1312
+ $(_.$slides[slideIndex]).clone(true).attr('id', '').appendTo(
1313
+ _.$slideTrack).addClass('slick-cloned');
1293
1314
  }
1315
+ _.$slideTrack.find('.slick-cloned').find('[id]').each(function() {
1316
+ $(this).attr('id', '');
1317
+ });
1294
1318
 
1295
- _.currentSlide = animSlide;
1319
+ }
1296
1320
 
1297
- _.setSlideClasses(_.currentSlide);
1321
+ }
1298
1322
 
1299
- _.updateDots();
1300
- _.updateArrows();
1323
+ };
1301
1324
 
1302
- if (_.options.fade === true) {
1303
- _.fadeSlide(animSlide, function() {
1304
- _.postSlide(animSlide);
1305
- });
1306
- return false;
1307
- }
1325
+ Slick.prototype.selectHandler = function(event) {
1326
+
1327
+ var _ = this;
1328
+ var asNavFor = _.options.asNavFor != null ? $(_.options.asNavFor).getSlick() : null;
1329
+ var index = parseInt($(event.target).parent().attr("index"));
1330
+ if(!index) index = 0;
1331
+
1332
+ if(_.slideCount <= _.options.slidesToShow){
1333
+ return;
1334
+ }
1335
+ _.slideHandler(index);
1336
+
1337
+ if(asNavFor != null){
1338
+ if(asNavFor.slideCount <= asNavFor.options.slidesToShow){
1339
+ return;
1340
+ }
1341
+ asNavFor.slideHandler(index);
1342
+ }
1343
+ };
1344
+
1345
+ Slick.prototype.slideHandler = function(index) {
1346
+
1347
+ var targetSlide, animSlide, slideLeft, unevenOffset, targetLeft = null,
1348
+ _ = this;
1349
+
1350
+ if (_.animating === true) {
1351
+ return false;
1352
+ }
1353
+
1354
+ targetSlide = index;
1355
+ targetLeft = _.getLeft(targetSlide);
1356
+ slideLeft = _.getLeft(_.currentSlide);
1357
+
1358
+ unevenOffset = _.slideCount % _.options.slidesToScroll !== 0 ? _.options.slidesToScroll : 0;
1359
+
1360
+ _.currentLeft = _.swipeLeft === null ? slideLeft : _.swipeLeft;
1308
1361
 
1309
- _.animateSlide(targetLeft, function() {
1310
- _.postSlide(animSlide);
1362
+ if (_.options.infinite === false && _.options.centerMode === false && (index < 0 || index > (_.slideCount - _.options.slidesToShow + unevenOffset))) {
1363
+ if(_.options.fade === false) {
1364
+ targetSlide = _.currentSlide;
1365
+ _.animateSlide(slideLeft, function() {
1366
+ _.postSlide(targetSlide);
1311
1367
  });
1368
+ }
1369
+ return false;
1370
+ } else if (_.options.infinite === false && _.options.centerMode === true && (index < 0 || index > (_.slideCount - _.options.slidesToScroll))) {
1371
+ if(_.options.fade === false) {
1372
+ targetSlide = _.currentSlide;
1373
+ _.animateSlide(slideLeft, function() {
1374
+ _.postSlide(targetSlide);
1375
+ });
1376
+ }
1377
+ return false;
1378
+ }
1312
1379
 
1313
- };
1380
+ if (_.options.autoplay === true) {
1381
+ clearInterval(_.autoPlayTimer);
1382
+ }
1314
1383
 
1315
- Slick.prototype.startLoad = function() {
1384
+ if (targetSlide < 0) {
1385
+ if (_.slideCount % _.options.slidesToScroll !== 0) {
1386
+ animSlide = _.slideCount - (_.slideCount % _.options.slidesToScroll);
1387
+ } else {
1388
+ animSlide = _.slideCount - _.options.slidesToScroll;
1389
+ }
1390
+ } else if (targetSlide > (_.slideCount - 1)) {
1391
+ animSlide = 0;
1392
+ } else {
1393
+ animSlide = targetSlide;
1394
+ }
1316
1395
 
1317
- var _ = this;
1396
+ _.animating = true;
1318
1397
 
1319
- if (_.options.arrows === true && _.slideCount > _.options.slidesToShow) {
1398
+ if (_.options.onBeforeChange !== null && index !== _.currentSlide) {
1399
+ _.options.onBeforeChange.call(this, _, _.currentSlide, animSlide);
1400
+ }
1320
1401
 
1321
- _.$prevArrow.hide();
1322
- _.$nextArrow.hide();
1402
+ _.currentSlide = animSlide;
1323
1403
 
1324
- }
1404
+ _.setSlideClasses(_.currentSlide);
1325
1405
 
1326
- if (_.options.dots === true && _.slideCount > _.options.slidesToShow) {
1406
+ _.updateDots();
1407
+ _.updateArrows();
1327
1408
 
1328
- _.$dots.hide();
1409
+ if (_.options.fade === true) {
1410
+ _.fadeSlide(animSlide, function() {
1411
+ _.postSlide(animSlide);
1412
+ });
1413
+ return false;
1414
+ }
1329
1415
 
1330
- }
1416
+ _.animateSlide(targetLeft, function() {
1417
+ _.postSlide(animSlide);
1418
+ });
1331
1419
 
1332
- _.$slider.addClass('slick-loading');
1420
+ };
1333
1421
 
1334
- };
1422
+ Slick.prototype.startLoad = function() {
1335
1423
 
1336
- Slick.prototype.swipeDirection = function() {
1424
+ var _ = this;
1337
1425
 
1338
- var xDist, yDist, r, swipeAngle, _ = this;
1426
+ if (_.options.arrows === true && _.slideCount > _.options.slidesToShow) {
1339
1427
 
1340
- xDist = _.touchObject.startX - _.touchObject.curX;
1341
- yDist = _.touchObject.startY - _.touchObject.curY;
1342
- r = Math.atan2(yDist, xDist);
1428
+ _.$prevArrow.hide();
1429
+ _.$nextArrow.hide();
1343
1430
 
1344
- swipeAngle = Math.round(r * 180 / Math.PI);
1345
- if (swipeAngle < 0) {
1346
- swipeAngle = 360 - Math.abs(swipeAngle);
1347
- }
1431
+ }
1348
1432
 
1349
- if ((swipeAngle <= 45) && (swipeAngle >= 0)) {
1350
- return 'left';
1351
- }
1352
- if ((swipeAngle <= 360) && (swipeAngle >= 315)) {
1353
- return 'left';
1354
- }
1355
- if ((swipeAngle >= 135) && (swipeAngle <= 225)) {
1356
- return 'right';
1357
- }
1433
+ if (_.options.dots === true && _.slideCount > _.options.slidesToShow) {
1358
1434
 
1359
- return 'vertical';
1435
+ _.$dots.hide();
1360
1436
 
1361
- };
1437
+ }
1362
1438
 
1363
- Slick.prototype.swipeEnd = function(event) {
1439
+ _.$slider.addClass('slick-loading');
1364
1440
 
1365
- var _ = this;
1441
+ };
1366
1442
 
1367
- _.$list.removeClass('dragging');
1443
+ Slick.prototype.swipeDirection = function() {
1368
1444
 
1369
- if (_.touchObject.curX === undefined) {
1370
- return false;
1371
- }
1445
+ var xDist, yDist, r, swipeAngle, _ = this;
1372
1446
 
1373
- if (_.touchObject.swipeLength >= _.touchObject.minSwipe) {
1374
- $(event.target).on('click.slick', function(event) {
1375
- event.stopImmediatePropagation();
1376
- event.stopPropagation();
1377
- event.preventDefault();
1378
- $(event.target).off('click.slick');
1379
- });
1380
-
1381
- switch (_.swipeDirection()) {
1382
- case 'left':
1383
- _.slideHandler(_.currentSlide + _.options.slidesToScroll);
1384
- _.touchObject = {};
1385
- break;
1386
-
1387
- case 'right':
1388
- _.slideHandler(_.currentSlide - _.options.slidesToScroll);
1389
- _.touchObject = {};
1390
- break;
1391
- }
1392
- } else {
1393
- if(_.touchObject.startX !== _.touchObject.curX) {
1394
- _.slideHandler(_.currentSlide);
1395
- _.touchObject = {};
1396
- }
1397
- }
1447
+ xDist = _.touchObject.startX - _.touchObject.curX;
1448
+ yDist = _.touchObject.startY - _.touchObject.curY;
1449
+ r = Math.atan2(yDist, xDist);
1398
1450
 
1399
- };
1451
+ swipeAngle = Math.round(r * 180 / Math.PI);
1452
+ if (swipeAngle < 0) {
1453
+ swipeAngle = 360 - Math.abs(swipeAngle);
1454
+ }
1400
1455
 
1401
- Slick.prototype.swipeHandler = function(event) {
1456
+ if ((swipeAngle <= 45) && (swipeAngle >= 0)) {
1457
+ return 'left';
1458
+ }
1459
+ if ((swipeAngle <= 360) && (swipeAngle >= 315)) {
1460
+ return 'left';
1461
+ }
1462
+ if ((swipeAngle >= 135) && (swipeAngle <= 225)) {
1463
+ return 'right';
1464
+ }
1402
1465
 
1403
- var _ = this;
1466
+ return 'vertical';
1404
1467
 
1405
- if ((_.options.swipe === false) || ('ontouchend' in document && _.options.swipe === false)) {
1406
- return undefined;
1407
- } else if ((_.options.draggable === false) || (_.options.draggable === false && !event.originalEvent.touches)) {
1408
- return undefined;
1409
- }
1468
+ };
1410
1469
 
1411
- _.touchObject.fingerCount = event.originalEvent && event.originalEvent.touches !== undefined ?
1412
- event.originalEvent.touches.length : 1;
1470
+ Slick.prototype.swipeEnd = function(event) {
1413
1471
 
1414
- _.touchObject.minSwipe = _.listWidth / _.options
1415
- .touchThreshold;
1472
+ var _ = this;
1473
+ var asNavFor = _.options.asNavFor != null ? $(_.options.asNavFor).getSlick() : null;
1416
1474
 
1417
- switch (event.data.action) {
1475
+ _.dragging = false;
1418
1476
 
1419
- case 'start':
1420
- _.swipeStart(event);
1421
- break;
1477
+ if (_.touchObject.curX === undefined) {
1478
+ return false;
1479
+ }
1422
1480
 
1423
- case 'move':
1424
- _.swipeMove(event);
1425
- break;
1481
+ if (_.touchObject.swipeLength >= _.touchObject.minSwipe) {
1482
+ $(event.target).on('click.slick', function(event) {
1483
+ event.stopImmediatePropagation();
1484
+ event.stopPropagation();
1485
+ event.preventDefault();
1486
+ $(event.target).off('click.slick');
1487
+ });
1488
+
1489
+ switch (_.swipeDirection()) {
1490
+ case 'left':
1491
+ _.slideHandler(_.currentSlide + _.options.slidesToScroll);
1492
+ if(asNavFor != null) asNavFor.slideHandler(asNavFor.currentSlide + asNavFor.options.slidesToScroll);
1493
+ _.touchObject = {};
1494
+ break;
1495
+
1496
+ case 'right':
1497
+ _.slideHandler(_.currentSlide - _.options.slidesToScroll);
1498
+ if(asNavFor != null) asNavFor.slideHandler(asNavFor.currentSlide - asNavFor.options.slidesToScroll);
1499
+ _.touchObject = {};
1500
+ break;
1501
+ }
1502
+ } else {
1503
+ if(_.touchObject.startX !== _.touchObject.curX) {
1504
+ _.slideHandler(_.currentSlide);
1505
+ if(asNavFor != null) asNavFor.slideHandler(asNavFor.currentSlide);
1506
+ _.touchObject = {};
1507
+ }
1508
+ }
1426
1509
 
1427
- case 'end':
1428
- _.swipeEnd(event);
1429
- break;
1510
+ };
1430
1511
 
1431
- }
1512
+ Slick.prototype.swipeHandler = function(event) {
1432
1513
 
1433
- };
1514
+ var _ = this;
1434
1515
 
1435
- Slick.prototype.swipeMove = function(event) {
1516
+ if ((_.options.swipe === false) || ('ontouchend' in document && _.options.swipe === false)) {
1517
+ return;
1518
+ } else if ((_.options.draggable === false) || (_.options.draggable === false && !event.originalEvent.touches)) {
1519
+ return;
1520
+ }
1436
1521
 
1437
- var _ = this,
1438
- curLeft, swipeDirection, positionOffset, touches;
1522
+ _.touchObject.fingerCount = event.originalEvent && event.originalEvent.touches !== undefined ?
1523
+ event.originalEvent.touches.length : 1;
1439
1524
 
1440
- touches = event.originalEvent !== undefined ? event.originalEvent.touches : null;
1525
+ _.touchObject.minSwipe = _.listWidth / _.options
1526
+ .touchThreshold;
1441
1527
 
1442
- curLeft = _.getLeft(_.currentSlide);
1528
+ switch (event.data.action) {
1443
1529
 
1444
- if (!_.$list.hasClass('dragging') || touches && touches.length !== 1) {
1445
- return false;
1446
- }
1530
+ case 'start':
1531
+ _.swipeStart(event);
1532
+ break;
1447
1533
 
1448
- _.touchObject.curX = touches !== undefined ? touches[0].pageX : event.clientX;
1449
- _.touchObject.curY = touches !== undefined ? touches[0].pageY : event.clientY;
1534
+ case 'move':
1535
+ _.swipeMove(event);
1536
+ break;
1450
1537
 
1451
- _.touchObject.swipeLength = Math.round(Math.sqrt(
1452
- Math.pow(_.touchObject.curX - _.touchObject.startX, 2)));
1538
+ case 'end':
1539
+ _.swipeEnd(event);
1540
+ break;
1453
1541
 
1454
- swipeDirection = _.swipeDirection();
1542
+ }
1455
1543
 
1456
- if (swipeDirection === 'vertical') {
1457
- return;
1458
- }
1544
+ };
1459
1545
 
1460
- if (event.originalEvent !== undefined && _.touchObject.swipeLength > 4) {
1461
- event.preventDefault();
1462
- }
1546
+ Slick.prototype.swipeMove = function(event) {
1463
1547
 
1464
- positionOffset = _.touchObject.curX > _.touchObject.startX ? 1 : -1;
1548
+ var _ = this,
1549
+ curLeft, swipeDirection, positionOffset, touches;
1465
1550
 
1466
- if (_.options.vertical === false) {
1467
- _.swipeLeft = curLeft + _.touchObject.swipeLength * positionOffset;
1468
- } else {
1469
- _.swipeLeft = curLeft + (_.touchObject
1470
- .swipeLength * (_.$list.height() / _.listWidth)) * positionOffset;
1471
- }
1551
+ touches = event.originalEvent !== undefined ? event.originalEvent.touches : null;
1472
1552
 
1473
- if (_.options.fade === true || _.options.touchMove === false) {
1474
- return false;
1475
- }
1553
+ curLeft = _.getLeft(_.currentSlide);
1476
1554
 
1477
- if (_.animating === true) {
1478
- _.swipeLeft = null;
1479
- return false;
1480
- }
1555
+ if (!_.dragging || touches && touches.length !== 1) {
1556
+ return false;
1557
+ }
1481
1558
 
1482
- _.setCSS(_.swipeLeft);
1559
+ _.touchObject.curX = touches !== undefined ? touches[0].pageX : event.clientX;
1560
+ _.touchObject.curY = touches !== undefined ? touches[0].pageY : event.clientY;
1483
1561
 
1484
- };
1562
+ _.touchObject.swipeLength = Math.round(Math.sqrt(
1563
+ Math.pow(_.touchObject.curX - _.touchObject.startX, 2)));
1485
1564
 
1486
- Slick.prototype.swipeStart = function(event) {
1565
+ swipeDirection = _.swipeDirection();
1487
1566
 
1488
- var _ = this,
1489
- touches;
1567
+ if (swipeDirection === 'vertical') {
1568
+ return;
1569
+ }
1490
1570
 
1491
- if (_.touchObject.fingerCount !== 1 || _.slideCount <= _.options.slidesToShow) {
1492
- _.touchObject = {};
1493
- return false;
1494
- }
1571
+ if (event.originalEvent !== undefined && _.touchObject.swipeLength > 4) {
1572
+ event.preventDefault();
1573
+ }
1495
1574
 
1496
- if (event.originalEvent !== undefined && event.originalEvent.touches !== undefined) {
1497
- touches = event.originalEvent.touches[0];
1498
- }
1575
+ positionOffset = _.touchObject.curX > _.touchObject.startX ? 1 : -1;
1499
1576
 
1500
- _.touchObject.startX = _.touchObject.curX = touches !== undefined ? touches.pageX : event.clientX;
1501
- _.touchObject.startY = _.touchObject.curY = touches !== undefined ? touches.pageY : event.clientY;
1577
+ if (_.options.vertical === false) {
1578
+ _.swipeLeft = curLeft + _.touchObject.swipeLength * positionOffset;
1579
+ } else {
1580
+ _.swipeLeft = curLeft + (_.touchObject
1581
+ .swipeLength * (_.$list.height() / _.listWidth)) * positionOffset;
1582
+ }
1502
1583
 
1503
- _.$list.addClass('dragging');
1584
+ if (_.options.fade === true || _.options.touchMove === false) {
1585
+ return false;
1586
+ }
1504
1587
 
1505
- };
1588
+ if (_.animating === true) {
1589
+ _.swipeLeft = null;
1590
+ return false;
1591
+ }
1506
1592
 
1507
- Slick.prototype.unfilterSlides = function() {
1593
+ _.setCSS(_.swipeLeft);
1508
1594
 
1509
- var _ = this;
1595
+ };
1510
1596
 
1511
- if (_.$slidesCache !== null) {
1597
+ Slick.prototype.swipeStart = function(event) {
1512
1598
 
1513
- _.unload();
1599
+ var _ = this,
1600
+ touches;
1514
1601
 
1515
- _.$slideTrack.children(this.options.slide).remove();
1602
+ if (_.touchObject.fingerCount !== 1 || _.slideCount <= _.options.slidesToShow) {
1603
+ _.touchObject = {};
1604
+ return false;
1605
+ }
1516
1606
 
1517
- _.$slidesCache.appendTo(_.$slideTrack);
1607
+ if (event.originalEvent !== undefined && event.originalEvent.touches !== undefined) {
1608
+ touches = event.originalEvent.touches[0];
1609
+ }
1518
1610
 
1519
- _.reinit();
1611
+ _.touchObject.startX = _.touchObject.curX = touches !== undefined ? touches.pageX : event.clientX;
1612
+ _.touchObject.startY = _.touchObject.curY = touches !== undefined ? touches.pageY : event.clientY;
1520
1613
 
1521
- }
1614
+ _.dragging = true;
1522
1615
 
1523
- };
1616
+ };
1524
1617
 
1525
- Slick.prototype.unload = function() {
1618
+ Slick.prototype.unfilterSlides = function() {
1526
1619
 
1527
- var _ = this;
1620
+ var _ = this;
1528
1621
 
1529
- $('.slick-cloned', _.$slider).remove();
1530
- if (_.$dots) {
1531
- _.$dots.remove();
1532
- }
1533
- if (_.$prevArrow) {
1534
- _.$prevArrow.remove();
1535
- _.$nextArrow.remove();
1536
- }
1537
- _.$slides.removeClass(
1538
- 'slick-slide slick-active slick-visible').removeAttr('style');
1622
+ if (_.$slidesCache !== null) {
1539
1623
 
1540
- };
1624
+ _.unload();
1541
1625
 
1542
- Slick.prototype.updateArrows = function() {
1626
+ _.$slideTrack.children(this.options.slide).detach();
1543
1627
 
1544
- var _ = this;
1628
+ _.$slidesCache.appendTo(_.$slideTrack);
1545
1629
 
1546
- if (_.options.arrows === true && _.options.infinite !==
1547
- true && _.slideCount > _.options.slidesToShow) {
1548
- _.$prevArrow.removeClass('slick-disabled');
1549
- _.$nextArrow.removeClass('slick-disabled');
1550
- if (_.currentSlide === 0) {
1551
- _.$prevArrow.addClass('slick-disabled');
1552
- _.$nextArrow.removeClass('slick-disabled');
1553
- } else if (_.currentSlide >= _.slideCount - _.options.slidesToShow) {
1554
- _.$nextArrow.addClass('slick-disabled');
1555
- _.$prevArrow.removeClass('slick-disabled');
1556
- }
1557
- }
1630
+ _.reinit();
1558
1631
 
1559
- };
1632
+ }
1560
1633
 
1561
- Slick.prototype.updateDots = function() {
1634
+ };
1562
1635
 
1563
- var _ = this;
1636
+ Slick.prototype.unload = function() {
1564
1637
 
1565
- if (_.$dots !== null) {
1638
+ var _ = this;
1566
1639
 
1567
- _.$dots.find('li').removeClass('slick-active');
1568
- _.$dots.find('li').eq(_.currentSlide / _.options.slidesToScroll).addClass(
1569
- 'slick-active');
1640
+ $('.slick-cloned', _.$slider).remove();
1641
+ if (_.$dots) {
1642
+ _.$dots.remove();
1643
+ }
1644
+ if (_.$prevArrow) {
1645
+ _.$prevArrow.remove();
1646
+ _.$nextArrow.remove();
1647
+ }
1648
+ _.$slides.removeClass(
1649
+ 'slick-slide slick-active slick-visible').removeAttr('style');
1650
+
1651
+ };
1652
+
1653
+ Slick.prototype.updateArrows = function() {
1654
+
1655
+ var _ = this;
1656
+
1657
+ if (_.options.arrows === true && _.options.infinite !==
1658
+ true && _.slideCount > _.options.slidesToShow) {
1659
+ _.$prevArrow.removeClass('slick-disabled');
1660
+ _.$nextArrow.removeClass('slick-disabled');
1661
+ if (_.currentSlide === 0) {
1662
+ _.$prevArrow.addClass('slick-disabled');
1663
+ _.$nextArrow.removeClass('slick-disabled');
1664
+ } else if (_.currentSlide >= _.slideCount - _.options.slidesToShow) {
1665
+ _.$nextArrow.addClass('slick-disabled');
1666
+ _.$prevArrow.removeClass('slick-disabled');
1667
+ }
1668
+ }
1570
1669
 
1571
- }
1670
+ };
1572
1671
 
1573
- };
1672
+ Slick.prototype.updateDots = function() {
1574
1673
 
1575
- $.fn.slick = function(options) {
1576
- var _ = this;
1577
- return _.each(function(index, element) {
1674
+ var _ = this;
1578
1675
 
1579
- element.slick = new Slick(element, options);
1676
+ if (_.$dots !== null) {
1580
1677
 
1581
- });
1582
- };
1678
+ _.$dots.find('li').removeClass('slick-active');
1679
+ _.$dots.find('li').eq(Math.floor(_.currentSlide / _.options.slidesToScroll)).addClass('slick-active');
1583
1680
 
1584
- $.fn.slickAdd = function(slide, slideIndex, addBefore) {
1585
- var _ = this;
1586
- return _.each(function(index, element) {
1681
+ }
1587
1682
 
1588
- element.slick.addSlide(slide, slideIndex, addBefore);
1683
+ };
1589
1684
 
1590
- });
1591
- };
1685
+ $.fn.slick = function(options) {
1686
+ var _ = this;
1687
+ return _.each(function(index, element) {
1592
1688
 
1593
- $.fn.slickCurrentSlide = function() {
1594
- var _ = this;
1595
- return _.get(0).slick.getCurrent();
1596
- };
1689
+ element.slick = new Slick(element, options);
1597
1690
 
1598
- $.fn.slickFilter = function(filter) {
1599
- var _ = this;
1600
- return _.each(function(index, element) {
1691
+ });
1692
+ };
1601
1693
 
1602
- element.slick.filterSlides(filter);
1694
+ $.fn.slickAdd = function(slide, slideIndex, addBefore) {
1695
+ var _ = this;
1696
+ return _.each(function(index, element) {
1603
1697
 
1604
- });
1605
- };
1698
+ element.slick.addSlide(slide, slideIndex, addBefore);
1606
1699
 
1607
- $.fn.slickGoTo = function(slide) {
1608
- var _ = this;
1609
- return _.each(function(index, element) {
1700
+ });
1701
+ };
1610
1702
 
1611
- element.slick.slideHandler(slide);
1703
+ $.fn.slickCurrentSlide = function() {
1704
+ var _ = this;
1705
+ return _.get(0).slick.getCurrent();
1706
+ };
1612
1707
 
1613
- });
1614
- };
1708
+ $.fn.slickFilter = function(filter) {
1709
+ var _ = this;
1710
+ return _.each(function(index, element) {
1615
1711
 
1616
- $.fn.slickNext = function() {
1617
- var _ = this;
1618
- return _.each(function(index, element) {
1712
+ element.slick.filterSlides(filter);
1619
1713
 
1620
- element.slick.changeSlide({
1621
- data: {
1622
- message: 'next'
1623
- }
1624
- });
1714
+ });
1715
+ };
1625
1716
 
1626
- });
1627
- };
1717
+ $.fn.slickGoTo = function(slide) {
1718
+ var _ = this;
1719
+ return _.each(function(index, element) {
1628
1720
 
1629
- $.fn.slickPause = function() {
1630
- var _ = this;
1631
- return _.each(function(index, element) {
1721
+ var asNavFor = element.slick.options.asNavFor != null ? $(element.slick.options.asNavFor) : null;
1722
+ if(asNavFor != null) asNavFor.slickGoTo(slide);
1723
+ element.slick.slideHandler(slide);
1632
1724
 
1633
- element.slick.autoPlayClear();
1634
- element.slick.paused = true;
1725
+ });
1726
+ };
1635
1727
 
1636
- });
1637
- };
1728
+ $.fn.slickNext = function() {
1729
+ var _ = this;
1730
+ return _.each(function(index, element) {
1638
1731
 
1639
- $.fn.slickPlay = function() {
1640
- var _ = this;
1641
- return _.each(function(index, element) {
1732
+ element.slick.changeSlide({
1733
+ data: {
1734
+ message: 'next'
1735
+ }
1736
+ });
1642
1737
 
1643
- element.slick.paused = false;
1644
- element.slick.autoPlay();
1738
+ });
1739
+ };
1645
1740
 
1646
- });
1647
- };
1741
+ $.fn.slickPause = function() {
1742
+ var _ = this;
1743
+ return _.each(function(index, element) {
1648
1744
 
1649
- $.fn.slickPrev = function() {
1650
- var _ = this;
1651
- return _.each(function(index, element) {
1745
+ element.slick.autoPlayClear();
1746
+ element.slick.paused = true;
1652
1747
 
1653
- element.slick.changeSlide({
1654
- data: {
1655
- message: 'previous'
1656
- }
1657
- });
1748
+ });
1749
+ };
1658
1750
 
1659
- });
1660
- };
1751
+ $.fn.slickPlay = function() {
1752
+ var _ = this;
1753
+ return _.each(function(index, element) {
1661
1754
 
1662
- $.fn.slickRemove = function(slideIndex, removeBefore) {
1663
- var _ = this;
1664
- return _.each(function(index, element) {
1755
+ element.slick.paused = false;
1756
+ element.slick.autoPlay();
1665
1757
 
1666
- element.slick.removeSlide(slideIndex, removeBefore);
1758
+ });
1759
+ };
1667
1760
 
1668
- });
1669
- };
1761
+ $.fn.slickPrev = function() {
1762
+ var _ = this;
1763
+ return _.each(function(index, element) {
1670
1764
 
1671
- $.fn.slickSetOption = function(option, value, refresh) {
1672
- var _ = this;
1673
- return _.each(function(index, element) {
1765
+ element.slick.changeSlide({
1766
+ data: {
1767
+ message: 'previous'
1768
+ }
1769
+ });
1674
1770
 
1675
- element.slick.options[option] = value;
1771
+ });
1772
+ };
1676
1773
 
1677
- if (refresh === true) {
1678
- element.slick.unload();
1679
- element.slick.reinit();
1680
- }
1774
+ $.fn.slickRemove = function(slideIndex, removeBefore) {
1775
+ var _ = this;
1776
+ return _.each(function(index, element) {
1681
1777
 
1682
- });
1683
- };
1778
+ element.slick.removeSlide(slideIndex, removeBefore);
1684
1779
 
1685
- $.fn.slickUnfilter = function() {
1686
- var _ = this;
1687
- return _.each(function(index, element) {
1780
+ });
1781
+ };
1688
1782
 
1689
- element.slick.unfilterSlides();
1783
+ $.fn.slickGetOption = function(option) {
1784
+ var _ = this;
1785
+ return _.get(0).slick.options[option];
1786
+ };
1690
1787
 
1691
- });
1692
- };
1788
+ $.fn.slickSetOption = function(option, value, refresh) {
1789
+ var _ = this;
1790
+ return _.each(function(index, element) {
1693
1791
 
1694
- $.fn.unslick = function() {
1695
- var _ = this;
1696
- return _.each(function(index, element) {
1792
+ element.slick.options[option] = value;
1697
1793
 
1698
- element.slick.destroy();
1794
+ if (refresh === true) {
1795
+ element.slick.unload();
1796
+ element.slick.reinit();
1797
+ }
1699
1798
 
1700
- });
1701
- };
1799
+ });
1800
+ };
1801
+
1802
+ $.fn.slickUnfilter = function() {
1803
+ var _ = this;
1804
+ return _.each(function(index, element) {
1805
+
1806
+ element.slick.unfilterSlides();
1807
+
1808
+ });
1809
+ };
1810
+
1811
+ $.fn.unslick = function() {
1812
+ var _ = this;
1813
+ return _.each(function(index, element) {
1814
+
1815
+ if (element.slick) {
1816
+ element.slick.destroy();
1817
+ }
1818
+
1819
+ });
1820
+ };
1821
+
1822
+ $.fn.getSlick = function() {
1823
+ var s = null;
1824
+ var _ = this;
1825
+ _.each(function(index, element) {
1826
+ s = element.slick;
1827
+ });
1828
+
1829
+ return s;
1830
+ };
1702
1831
 
1703
1832
  }));