slick_rails 1.3.15 → 1.4.0

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