slick_rails 1.3.2 → 1.3.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fea7a560b5eaa6dc15b7335bb99697f99876f160
4
- data.tar.gz: 6a24ac67e2f04271c5acd72e61d3f10a9bfc2cf5
3
+ metadata.gz: 04d771922c1d4cc6172abf21cd67cf605411e294
4
+ data.tar.gz: aaee393756949b9ad5b68dc714596003eac732b5
5
5
  SHA512:
6
- metadata.gz: 349a37b177339c55f5f1dfc99ab518e77314a0108f6fc46ecf9b8864439bfb7421b270ce98e45d0badb13435495b4fe9a112d2922bca7704d3ac67535d178fca
7
- data.tar.gz: 27f8c76d054e7a8933fa69e272e7fcfe6c131ba221549a433869c7795aa667aa99a8c5dd57833849a81ae07f18f73b8aa868e056adf7d1fcb9fb51d4594b6cb2
6
+ metadata.gz: eab191db4b03b623fbdaec1e61a34943c39d8eda58470737fc2cfd083f62595121c6268d021aa7301099ac53eb7f8484eae3da102503077ef136b2618613e784
7
+ data.tar.gz: dd91dc302f8a0d6b486e66139ad0e1c96837d9ec30ff0c75b23469c73f99aa3e74eda6257a2017f14b192e163d83c47bab7bb0c4bcbdec5067d4bbc2b71d31bd
@@ -8,7 +8,6 @@
8
8
 
9
9
  Author: Ken Wheeler
10
10
  Website: http://kenwheeler.github.io
11
- Date: 04/02/14
12
11
  Docs: http://kenwheeler.github.io/slick
13
12
  Repo: http://github.com/kenwheeler/slick
14
13
  Issues: http://github.com/kenwheeler/slick/issues
@@ -30,6 +29,7 @@
30
29
  var Slick = window.Slick || {};
31
30
 
32
31
  Slick = (function () {
32
+ var instanceUid = 0;
33
33
 
34
34
  function Slick(element, settings) {
35
35
 
@@ -37,17 +37,22 @@
37
37
 
38
38
  _.defaults = {
39
39
  accessibility: true,
40
+ arrows: true,
40
41
  autoplay: false,
41
42
  autoplaySpeed: 3000,
43
+ centerMode: false,
44
+ centerPadding: 50,
42
45
  cssEase: 'ease',
43
46
  dots: false,
44
47
  draggable: true,
45
- fade: false,
46
48
  easing: 'linear',
47
- arrows: true,
49
+ fade: false,
48
50
  infinite: true,
51
+ lazyLoad: 'ondemand',
49
52
  onBeforeChange: null,
50
53
  onAfterChange: null,
54
+ onInit : null,
55
+ onReInit : null,
51
56
  pauseOnHover: true,
52
57
  placeholders: true,
53
58
  responsive: null,
@@ -79,6 +84,7 @@
79
84
  slides : null,
80
85
  sliding : false,
81
86
  slideOffset : 0,
87
+ placeholderOffset : 0,
82
88
  swipeLeft : null,
83
89
  list : null,
84
90
  touchObject : {},
@@ -138,6 +144,7 @@
138
144
  _.autoPlayIterator = $.proxy(_.autoPlayIterator,
139
145
  _);
140
146
 
147
+ _.instanceUid = instanceUid++;
141
148
  _.init();
142
149
 
143
150
  }
@@ -146,53 +153,39 @@
146
153
 
147
154
  }());
148
155
 
149
- Slick.prototype.init = function () {
150
-
151
- var _ = this;
156
+ Slick.prototype.addSlide = function (markup, index, addBefore) {
152
157
 
153
- if (!$(_.slider).hasClass('slick-initialized')) {
158
+ var _ = this,
159
+ slideTrackChildren;
154
160
 
155
- $(_.slider).addClass('slick-initialized');
156
- _.buildOut();
157
- _.setProps();
158
- _.startLoad();
159
- _.loadSlider();
160
- _.initializeEvents();
161
- _.checkResponsive();
161
+ if (typeof(index) === "boolean") {
162
+ addBefore = index;
163
+ index = null;
162
164
  }
163
165
 
164
- };
165
-
166
- Slick.prototype.addSlide = function (markup) {
167
-
168
- var _ = this;
169
-
170
166
  _.unload();
171
167
 
172
- $(markup).appendTo(_.slideTrack);
173
-
174
- _.slides = _.slideTrack.children(this.options.slide);
175
-
176
- _.slideTrack.children(this.options.slide).remove();
177
-
178
- _.slideTrack.append(_.slides);
179
-
180
- _.reinit();
181
-
182
- };
183
-
184
- Slick.prototype.removeSlide = function (index) {
185
-
186
- var _ = this;
187
-
188
- _.unload();
168
+ slideTrackChildren = _.slideTrack.children(this.options.slide);
189
169
 
190
- if(_.slideCount < 1) {
191
- return false;
170
+ if (typeof(index) === "number") {
171
+ if (index === 0 && $(slideTrackChildren).length === 0) {
172
+ $(markup).appendTo(_.slideTrack);
173
+ } else if (index < 0 || (index >= $(slideTrackChildren).length && $(slideTrackChildren).length !== 0) ) {
174
+ _.reinit();
175
+ return false;
176
+ } else if (addBefore) {
177
+ $(markup).insertBefore($(slideTrackChildren.get(index)));
178
+ } else {
179
+ $(markup).insertAfter($(slideTrackChildren.get(index)));
180
+ }
181
+ } else {
182
+ if (addBefore === true) {
183
+ $(markup).prependTo(_.slideTrack);
184
+ } else {
185
+ $(markup).appendTo(_.slideTrack);
186
+ }
192
187
  }
193
188
 
194
- $(_.slideTrack.children(this.options.slide).get(index)).remove();
195
-
196
189
  _.slides = _.slideTrack.children(this.options.slide);
197
190
 
198
191
  _.slideTrack.children(this.options.slide).remove();
@@ -203,37 +196,72 @@
203
196
 
204
197
  };
205
198
 
206
- Slick.prototype.filterSlides = function (filter) {
207
-
208
- var _ = this;
209
-
210
- if(filter !== null) {
211
-
212
- _.unload();
199
+ Slick.prototype.animateSlide = function (targetLeft,
200
+ callback) {
213
201
 
214
- _.slideTrack.children(this.options.slide).remove();
202
+ var animProps = {}, _ = this;
215
203
 
216
- _.slidesCache.filter(filter).appendTo(_.slideTrack);
204
+ if (_.transformsEnabled === false) {
205
+ if (_.options.vertical === false) {
206
+ _.slideTrack.animate({
207
+ left: targetLeft
208
+ }, _.options.speed,_.options.easing, callback);
209
+ } else {
210
+ _.slideTrack.animate({
211
+ top: targetLeft
212
+ }, _.options.speed,_.options.easing, callback);
213
+ }
217
214
 
218
- _.reinit();
215
+ } else {
219
216
 
220
- }
217
+ if(_.cssTransitions === false) {
221
218
 
222
- };
219
+ $({
220
+ animStart: _.currentLeft
221
+ }).animate({
222
+ animStart: targetLeft
223
+ }, {
224
+ duration: _.options.speed,
225
+ easing: _.options.easing,
226
+ step: function (now) {
227
+ if (_.options.vertical === false) {
228
+ animProps[_.animType] = "translate(" +
229
+ now + "px, 0px)";
230
+ _.slideTrack.css(animProps);
231
+ } else {
232
+ animProps[_.animType] = "translate(0px," +
233
+ now + "px,0px)";
234
+ _.slideTrack.css(animProps);
235
+ }
236
+ },
237
+ complete: function () {
238
+ if (callback) {
239
+ callback.call();
240
+ }
241
+ }
242
+ });
223
243
 
224
- Slick.prototype.unfilterSlides = function () {
244
+ } else {
225
245
 
226
- var _ = this;
246
+ _.applyTransition();
227
247
 
228
- if(_.slidesCache !== null) {
248
+ if (_.options.vertical === false) {
249
+ animProps[_.animType] = "translate3d(" + targetLeft + "px, 0px, 0px)";
250
+ } else {
251
+ animProps[_.animType] = "translate3d(0px," + targetLeft + "px, 0px)";
252
+ }
253
+ _.slideTrack.css(animProps);
229
254
 
230
- _.unload();
255
+ if(callback) {
256
+ setTimeout(function(){
231
257
 
232
- _.slideTrack.children(this.options.slide).remove();
258
+ _.disableTransition();
233
259
 
234
- _.slidesCache.appendTo(_.slideTrack);
260
+ callback.call();
261
+ }, _.options.speed);
262
+ }
235
263
 
236
- _.reinit();
264
+ }
237
265
 
238
266
  }
239
267
 
@@ -263,23 +291,6 @@
263
291
 
264
292
  };
265
293
 
266
- Slick.prototype.disableTransition = function (slide) {
267
-
268
- var _ = this;
269
-
270
- if (_.options.fade === false) {
271
- _.slideTrack.css({
272
- transition: '',
273
- transformOrigin: ''
274
- });
275
- } else {
276
- $(_.slides.get(slide)).css({
277
- transition: ''
278
- });
279
- }
280
-
281
- };
282
-
283
294
  Slick.prototype.autoPlay = function () {
284
295
 
285
296
  var _ = this;
@@ -342,7 +353,118 @@
342
353
 
343
354
  };
344
355
 
356
+ Slick.prototype.buildArrows = function () {
357
+
358
+ var _ = this;
359
+
360
+ if (_.options.arrows === true && _.slideCount > _.options.slidesToShow) {
361
+
362
+ _.prevArrow = $(
363
+ '<button type="button" tabIndex="-1">Previous</button>').appendTo(
364
+ _.slider).addClass('slick-prev');
365
+ _.nextArrow = $(
366
+ '<button type="button" tabIndex="-1">Next</button>').appendTo(
367
+ _.slider).addClass('slick-next');
368
+
369
+ if (_.options.infinite !== true) {
370
+ _.prevArrow.addClass('slick-disabled');
371
+ }
372
+
373
+ }
374
+
375
+ };
376
+
377
+ Slick.prototype.buildDots = function () {
378
+
379
+ var _ = this, i, dotString;
380
+
381
+ if (_.options.dots === true && _.slideCount > _.options.slidesToShow) {
382
+
383
+ dotString = '<ul class="slick-dots">';
384
+
385
+ for (i = 1; i <= _.slideCount; i += 1) {
386
+
387
+ dotString += '<li><a href="javascript:void(0)" tabIndex="-1">' + i +
388
+ '</a></li>';
389
+ if (_.options.placeholders === false && i +
390
+ _.options.slidesToShow - (_.options.slidesToScroll - 1) > _.slideCount) {
391
+ break;
392
+ }
393
+ }
394
+
395
+ dotString += "</ul>";
396
+
397
+ _.dots = $(dotString).appendTo(
398
+ _.slider);
399
+
400
+ if (_.options.slidesToScroll > 1) {
401
+ _.dots.find('li').hide();
402
+ i = 0;
403
+ while (i < _.slideCount) {
404
+ $(_.dots.find('li').get(i)).show();
405
+ i = i + _.options.slidesToScroll;
406
+ }
407
+ }
408
+
409
+ _.dots.find('li').first().addClass(
410
+ 'slick-active');
411
+
412
+ }
413
+
414
+ };
415
+
416
+ Slick.prototype.buildOut = function () {
417
+
418
+ var _ = this;
419
+
420
+ _.slides = _.slider.children(_.options.slide +
421
+ ':not(.slick-cloned)').addClass(
422
+ 'slick-slide');
423
+ _.slideCount = _.slides.length;
424
+ _.slidesCache = _.slides;
425
+
426
+ _.slider.addClass("slick-slider");
427
+
428
+ _.slideTrack = (_.slideCount === 0) ?
429
+ $('<div class="slick-track"/>').appendTo(_.slider) :
430
+ _.slides.wrapAll('<div class="slick-track"/>').parent();
431
+
432
+ _.list = _.slideTrack.wrap(
433
+ '<div class="slick-list"/>').parent();
434
+ _.slideTrack.css('opacity', 0);
435
+
436
+ if(_.options.accessibility === true) {
437
+ _.list.prop('tabIndex',0);
438
+ }
439
+
440
+ if(_.options.centerMode === true) {
441
+ _.options.infinite = true;
442
+ _.options.slidesToScroll = 1;
443
+ if(_.options.slidesToShow % 2 === 0) {
444
+ _.options.slidesToShow = 3;
445
+ }
446
+ }
447
+
448
+ $('img[data-lazy]',_.slider).not('[src]').addClass('slick-loading');
449
+
450
+ _.setupPlaceholders();
451
+
452
+ _.setupInfinite();
453
+
454
+ _.buildArrows();
455
+
456
+ _.buildDots();
457
+
458
+ _.setSlideClasses(0);
459
+
460
+ if (_.options.draggable === true) {
461
+ _.list.addClass('draggable');
462
+ }
463
+
464
+ };
465
+
345
466
  Slick.prototype.checkResponsive = function () {
467
+
346
468
  var _ = this, breakpoint, targetBreakpoint;
347
469
 
348
470
  if (_.originalSettings.responsive && _.originalSettings
@@ -387,684 +509,795 @@
387
509
  }
388
510
 
389
511
  }
512
+
390
513
  };
391
514
 
392
- Slick.prototype.startLoad = function () {
515
+ Slick.prototype.changeSlide = function (event) {
393
516
 
394
517
  var _ = this;
395
518
 
396
- if (_.options.arrows === true && _.slideCount > _.options.slidesToShow) {
519
+ switch (event.data.message) {
397
520
 
398
- _.prevArrow.hide();
399
- _.nextArrow.hide();
521
+ case 'previous':
522
+ _.slideHandler(_.currentSlide - _.options
523
+ .slidesToScroll);
524
+ break;
400
525
 
401
- }
526
+ case 'next':
527
+ _.slideHandler(_.currentSlide + _.options
528
+ .slidesToScroll);
529
+ break;
402
530
 
403
- if (_.options.dots === true && _.slideCount > _.options.slidesToShow) {
404
-
405
- _.dots.hide();
531
+ case 'index':
532
+ _.slideHandler($(event.target).parent().index());
533
+ break;
406
534
 
535
+ default:
536
+ return false;
407
537
  }
408
538
 
409
- _.slider.addClass('slick-loading');
410
-
411
539
  };
412
540
 
413
- Slick.prototype.initUI = function () {
541
+ Slick.prototype.destroy = function () {
414
542
 
415
543
  var _ = this;
416
544
 
417
- if (_.options.arrows === true && _.slideCount > _.options.slidesToShow) {
545
+ _.autoPlayClear();
418
546
 
419
- _.prevArrow.show();
420
- _.nextArrow.show();
547
+ _.touchObject = {};
421
548
 
549
+ $('.slick-cloned', _.slider).remove();
550
+ $('.slick-placeholder', _.slider).remove();
551
+ if (_.dots) {
552
+ _.dots.remove();
422
553
  }
423
-
424
- if (_.options.dots === true && _.slideCount > _.options.slidesToShow) {
425
-
426
- _.dots.show();
427
-
554
+ if (_.prevArrow) {
555
+ _.prevArrow.remove();
556
+ _.nextArrow.remove();
428
557
  }
558
+ _.slides.unwrap().unwrap();
559
+ _.slides.removeClass(
560
+ 'slick-slide slick-active slick-visible').removeAttr('style');
561
+ _.slider.removeClass('slick-slider');
562
+ _.slider.removeClass('slick-initialized');
429
563
 
430
- if (_.options.autoplay === true) {
564
+ _.list.off('.slick');
565
+ $(window).off('.slick'+_.instanceUid);
566
+ };
431
567
 
432
- _.autoPlay();
568
+ Slick.prototype.disableTransition = function (slide) {
569
+
570
+ var _ = this;
433
571
 
572
+ if (_.options.fade === false) {
573
+ _.slideTrack.css({
574
+ transition: '',
575
+ transformOrigin: ''
576
+ });
577
+ } else {
578
+ $(_.slides.get(slide)).css({
579
+ transition: ''
580
+ });
434
581
  }
435
582
 
436
583
  };
437
584
 
438
- Slick.prototype.loadSlider = function () {
585
+ Slick.prototype.fadeSlide = function (slideIndex, callback) {
439
586
 
440
587
  var _ = this;
441
588
 
442
- _.setPosition();
443
-
444
- _.slideTrack.css({
445
- opacity: 1
446
- });
589
+ if(_.cssTransitions === false) {
447
590
 
448
- if (document.readyState !== "complete") {
591
+ $(_.slides.get(slideIndex)).css({zIndex: 1000});
449
592
 
450
- $(window).load(function () {
593
+ $(_.slides.get(slideIndex)).animate({
594
+ opacity: 1
595
+ }, _.options.speed,_.options.easing, callback);
451
596
 
452
- _.slider.removeClass('slick-loading');
597
+ } else {
453
598
 
454
- _.initUI();
599
+ _.applyTransition(slideIndex);
455
600
 
601
+ $(_.slides.get(slideIndex)).css({
602
+ opacity: 1,
603
+ zIndex: 1000
456
604
  });
457
605
 
458
- } else {
606
+ if(callback) {
607
+ setTimeout(function(){
459
608
 
460
- _.slider.removeClass('slick-loading');
609
+ _.disableTransition(slideIndex);
461
610
 
462
- _.initUI();
611
+ callback.call();
612
+ }, _.options.speed);
613
+ }
463
614
 
464
615
  }
465
616
 
466
617
  };
467
618
 
468
- Slick.prototype.setValues = function () {
619
+ Slick.prototype.filterSlides = function (filter) {
469
620
 
470
621
  var _ = this;
471
622
 
472
- _.listWidth = _.list.width();
473
- _.listHeight = _.list.height();
474
- _.slideWidth = Math.ceil(_.listWidth / _.options
475
- .slidesToShow);
623
+ if(filter !== null) {
624
+
625
+ _.unload();
626
+
627
+ _.slideTrack.children(this.options.slide).remove();
628
+
629
+ _.slidesCache.filter(filter).appendTo(_.slideTrack);
630
+
631
+ _.reinit();
632
+
633
+ }
476
634
 
477
635
  };
478
636
 
479
- Slick.prototype.buildArrows = function () {
637
+ Slick.prototype.init = function () {
480
638
 
481
639
  var _ = this;
482
640
 
483
- if (_.options.arrows === true && _.slideCount > _.options.slidesToShow) {
641
+ if (!$(_.slider).hasClass('slick-initialized')) {
484
642
 
485
- _.prevArrow = $(
486
- '<button type="button" tabIndex="-1">Previous</button>').appendTo(
487
- _.slider).addClass('slick-prev');
488
- _.nextArrow = $(
489
- '<button type="button" tabIndex="-1">Next</button>').appendTo(
490
- _.slider).addClass('slick-next');
643
+ $(_.slider).addClass('slick-initialized');
644
+ _.buildOut();
645
+ _.setProps();
646
+ _.startLoad();
647
+ _.loadSlider();
648
+ _.initializeEvents();
649
+ _.checkResponsive();
650
+ }
491
651
 
492
- if (_.options.infinite !== true) {
493
- _.prevArrow.addClass('slick-disabled');
494
- }
652
+ if (_.options.onInit !== null) {
653
+ _.options.onInit.call(this, _);
654
+ }
655
+
656
+ };
657
+
658
+ Slick.prototype.initArrowEvents = function () {
659
+
660
+ var _ = this;
495
661
 
662
+ if (_.options.arrows === true && _.slideCount > _.options.slidesToShow) {
663
+ _.prevArrow.on('click.slick', {
664
+ message: 'previous'
665
+ }, _.changeSlide);
666
+ _.nextArrow.on('click.slick', {
667
+ message: 'next'
668
+ }, _.changeSlide);
496
669
  }
497
670
 
498
671
  };
499
672
 
500
- Slick.prototype.buildDots = function () {
673
+ Slick.prototype.initDotEvents = function () {
501
674
 
502
- var _ = this, i, dotString;
675
+ var _ = this;
503
676
 
504
677
  if (_.options.dots === true && _.slideCount > _.options.slidesToShow) {
678
+ $('li a', _.dots).on('click.slick', {
679
+ message: 'index'
680
+ }, _.changeSlide);
681
+ }
505
682
 
506
- dotString = '<ul class="slick-dots">';
683
+ };
507
684
 
508
- for (i = 1; i <= _.slideCount; i += 1) {
685
+ Slick.prototype.initializeEvents = function () {
509
686
 
510
- dotString += '<li><a href="javascript:void(0)" tabIndex="-1">' + i +
511
- '</a></li>';
512
- if (_.options.placeholders === false && i +
513
- _.options.slidesToShow - (_.options.slidesToScroll - 1) > _.slideCount) {
514
- break;
515
- }
516
- }
687
+ var _ = this;
517
688
 
518
- dotString += "</ul>";
689
+ _.initArrowEvents();
519
690
 
520
- _.dots = $(dotString).appendTo(
521
- _.slider);
691
+ _.initDotEvents();
522
692
 
523
- if (_.options.slidesToScroll > 1) {
524
- _.dots.find('li').hide();
525
- i = 0;
526
- while (i < _.slideCount) {
527
- $(_.dots.find('li').get(i)).show();
528
- i = i + _.options.slidesToScroll;
529
- }
530
- }
693
+ if (_.options.swipe === true) {
694
+ _.list.on('touchstart.slick', {
695
+ action: 'start',
696
+ kind: 'touch'
697
+ }, _.swipeHandler);
698
+ _.list.on('touchmove.slick', {
699
+ action: 'move',
700
+ kind: 'touch'
701
+ }, _.swipeHandler);
702
+ _.list.on('touchend.slick', {
703
+ action: 'end',
704
+ kind: 'touch'
705
+ }, _.swipeHandler);
706
+ _.list.on('touchcancel.slick', {
707
+ action: 'end',
708
+ kind: 'touch'
709
+ }, _.swipeHandler);
710
+ }
531
711
 
532
- _.dots.find('li').first().addClass(
533
- 'slick-active');
712
+ if (_.options.draggable === true) {
713
+ _.list.on('mousedown.slick', {
714
+ action: 'start',
715
+ kind: 'drag'
716
+ }, _.swipeHandler);
717
+ _.list.on('mousemove.slick', {
718
+ action: 'move',
719
+ kind: 'drag'
720
+ }, _.swipeHandler);
721
+ _.list.on('mouseup.slick', {
722
+ action: 'end',
723
+ kind: 'drag'
724
+ }, _.swipeHandler);
725
+ _.list.on('mouseleave.slick', {
726
+ action: 'end',
727
+ kind: 'drag'
728
+ }, _.swipeHandler);
729
+ }
534
730
 
731
+ if (_.options.pauseOnHover === true && _.options.autoplay === true) {
732
+ _.list.on('mouseenter.slick', _.autoPlayClear);
733
+ _.list.on('mouseleave.slick', _.autoPlay);
535
734
  }
536
735
 
537
- };
736
+ _.list.on('keydown.slick', _.keyHandler);
538
737
 
539
- Slick.prototype.setupInfinite = function () {
738
+ $(window).on('orientationchange.slick.slick'+_.instanceUid, function(){
739
+ _.checkResponsive();
740
+ _.setPosition();
741
+ });
540
742
 
541
- var _ = this, i, slideIndex;
743
+ $(window).on('resize.slick.slick'+_.instanceUid, function () {
744
+ if ($(window).width !== _.windowWidth) {
745
+ clearTimeout(_.windowDelay);
746
+ _.windowDelay = window.setTimeout(function () {
747
+ _.windowWidth = $(window).width();
748
+ _.checkResponsive();
749
+ _.setPosition();
750
+ }, 50);
751
+ }
752
+ });
542
753
 
543
- if (_.options.infinite === true && _.options.fade === false) {
754
+ $(window).on('load.slick.slick'+_.instanceUid, _.setPosition);
755
+ };
544
756
 
545
- slideIndex = null;
757
+ Slick.prototype.initUI = function () {
546
758
 
547
- if (_.slideCount > _.options.slidesToShow) {
759
+ var _ = this;
548
760
 
549
- for (i = _.slideCount; i > (_.slideCount -
550
- _.options.slidesToShow); i -= 1) {
551
- slideIndex = i - 1;
552
- $(_.slides[slideIndex]).clone().prependTo(
553
- _.slideTrack).addClass('slick-cloned');
554
- }
555
- for (i = 0; i < _.options.slidesToShow; i += 1) {
556
- slideIndex = i;
557
- $(_.slides[slideIndex]).clone().appendTo(
558
- _.slideTrack).addClass('slick-cloned');
559
- }
761
+ if (_.options.arrows === true && _.slideCount > _.options.slidesToShow) {
560
762
 
561
- }
763
+ _.prevArrow.show();
764
+ _.nextArrow.show();
562
765
 
563
766
  }
564
767
 
565
- };
566
-
567
- Slick.prototype.setupPlaceholders = function () {
768
+ if (_.options.dots === true && _.slideCount > _.options.slidesToShow) {
568
769
 
569
- var _ = this, i, placeholders;
770
+ _.dots.show();
570
771
 
571
- if(_.options.fade === true || _.options.vertical === true) {
572
- _.options.slidesToShow = 1;
573
- _.options.slidesToScroll = 1;
574
772
  }
575
773
 
576
- if(_.options.placeholders === false) {
577
- _.options.infinite === false;
578
- return false;
579
- }
774
+ if (_.options.autoplay === true) {
580
775
 
581
- if ((_.slideCount % _.options.slidesToScroll) !==
582
- 0 && _.slideCount > _.options.slidesToShow) {
776
+ _.autoPlay();
583
777
 
584
- placeholders = Math.abs(_.options.slidesToScroll -
585
- (_.slideCount % _.options.slidesToScroll)
586
- );
587
- for (i = 0; i < placeholders; i += 1) {
588
- $('<div/>').appendTo(_.slideTrack).addClass(
589
- 'slick-slide slick-placeholder');
590
- }
591
- _.slides = $('.slick-slide:not(.slick-cloned)',
592
- _.slider);
593
- _.slideCount = _.slides.length;
594
778
  }
595
779
 
596
780
  };
597
781
 
598
- Slick.prototype.buildOut = function () {
782
+ Slick.prototype.keyHandler = function (event) {
599
783
 
600
784
  var _ = this;
601
785
 
602
- _.slides = $(_.options.slide +
603
- ':not(.slick-cloned)', _.slider).addClass(
604
- 'slick-slide');
605
- _.slideCount = _.slides.length;
606
- _.slidesCache = _.slides;
607
-
608
- _.slider.addClass("slick-slider");
609
- _.slideTrack = _.slides.wrapAll(
610
- '<div class="slick-track"/>').parent();
611
- _.list = _.slideTrack.wrap(
612
- '<div class="slick-list"/>').parent();
613
- _.slideTrack.css('opacity', 0);
614
-
615
- if(_.options.accessibility === true) {
616
- _.list.prop('tabIndex',0);
786
+ if (event.keyCode === 37) {
787
+ _.changeSlide({data: {message: 'previous'}});
788
+ } else if (event.keyCode === 39) {
789
+ _.changeSlide({data: {message: 'next'}});
617
790
  }
618
791
 
619
- _.setupPlaceholders();
792
+ };
620
793
 
621
- _.setupInfinite();
794
+ Slick.prototype.lazyLoad = function (){
622
795
 
623
- _.buildArrows();
796
+ var _ = this, loadRange, cloneRange, rangeStart, rangeEnd;
624
797
 
625
- _.buildDots();
798
+ if (_.options.centerMode === true) {
799
+ rangeStart = _.options.slidesToShow + _.currentSlide - 1;
800
+ rangeEnd = rangeStart + _.options.slidesToShow + 2;
801
+ } else {
802
+ rangeStart = _.options.slidesToShow + _.currentSlide;
803
+ rangeEnd = rangeStart + _.options.slidesToShow;
804
+ }
626
805
 
627
- _.setSlideClasses(0);
806
+ loadRange = _.slider.find('.slick-slide').slice(rangeStart,rangeEnd);
628
807
 
629
- if (_.options.draggable === true) {
630
- _.list.addClass('draggable');
808
+ $('img[data-lazy]',loadRange).not('[src]').each(function(){
809
+ $(this).attr('src', $(this).attr('data-lazy')).removeClass('slick-loading');
810
+ });
811
+
812
+ if (_.currentSlide >= _.slideCount - _.options.slidesToShow) {
813
+ cloneRange = _.slider.find('.slick-cloned').slice(0,_.options.slidesToShow);
814
+ $('img[data-lazy]',cloneRange).not('[src]').each(function(){
815
+ $(this).attr('src', $(this).attr('data-lazy')).removeClass('slick-loading');
816
+ });
817
+ } else if (_.currentSlide === 0) {
818
+ cloneRange = _.slider.find('.slick-cloned').slice(_.options.slidesToShow * -1);
819
+ $('img[data-lazy]',cloneRange).not('[src]').each(function(){
820
+ $(this).attr('src', $(this).attr('data-lazy')).removeClass('slick-loading');
821
+ });
631
822
  }
632
823
 
633
824
  };
634
825
 
635
- Slick.prototype.setDimensions = function () {
826
+ Slick.prototype.loadSlider = function () {
636
827
 
637
828
  var _ = this;
638
829
 
639
- _.list.find('.slick-slide').width(_.slideWidth);
640
- if (_.options.vertical === false) {
641
- _.slideTrack.width(Math.ceil((_.slideWidth * _
642
- .slider.find('.slick-slide').length)));
643
- } else {
644
- _.list.height(_.slides.first().outerHeight());
645
- _.slideTrack.height(Math.ceil((_.listHeight * _
646
- .slider.find('.slick-slide').length)));
647
- }
830
+ _.setPosition();
648
831
 
649
- };
832
+ _.slideTrack.css({
833
+ opacity: 1
834
+ });
650
835
 
651
- Slick.prototype.setPosition = function () {
836
+ if (document.readyState !== "complete") {
652
837
 
653
- var _ = this, targetPosition, targetSlide;
838
+ $(window).load(function () {
654
839
 
655
- targetSlide = _.currentSlide;
840
+ _.slider.removeClass('slick-loading');
656
841
 
657
- _.setValues();
658
- _.setDimensions();
842
+ _.initUI();
659
843
 
660
- _.slideOffset = 0;
844
+ if (_.options.lazyLoad === 'progressive') {
845
+ _.progressiveLazyLoad();
846
+ }
661
847
 
662
- if (_.options.infinite === true) {
663
- if(_.slideCount > _.options.slidesToShow) {
664
- _.slideOffset = (_.slideWidth * _.options.slidesToShow) * -1;
665
- }
666
- }
848
+ });
667
849
 
668
- if (_.options.placeholders === false && _.currentSlide +
669
- _.options.slidesToScroll >= _.slideCount) {
670
- targetSlide = _.slideCount - _.options.slidesToShow;
671
- }
850
+ } else {
672
851
 
673
- if (_.options.fade === false) {
674
- if (_.options.vertical === false) {
675
- targetPosition = ((targetSlide *
676
- _.slideWidth) * -1) + _.slideOffset;
677
- } else {
678
- targetPosition = ((targetSlide *
679
- _.listHeight) * -1) - _.listHeight;
852
+ _.slider.removeClass('slick-loading');
853
+
854
+ _.initUI();
855
+
856
+ if (_.options.lazyLoad === 'progressive') {
857
+ _.progressiveLazyLoad();
680
858
  }
681
- _.setCSS(targetPosition);
682
- } else {
683
- _.setFade();
859
+
684
860
  }
861
+
685
862
  };
686
863
 
687
- Slick.prototype.setProps = function () {
864
+ Slick.prototype.postSlide = function (index) {
688
865
 
689
866
  var _ = this;
690
867
 
691
- _.positionProp = _.options.vertical === true ? 'top' : 'left';
692
-
693
- if (_.positionProp === 'top') {
694
- _.slider.addClass('slick-vertical');
695
- } else {
696
- _.slider.removeClass('slick-vertical');
868
+ if (_.options.onAfterChange !== null && index !== _.currentSlide) {
869
+ _.options.onAfterChange.call(this, _, index);
697
870
  }
698
871
 
699
- if ( document.body.style.WebkitTransition !== undefined ||
700
- document.body.style.MozTransition !== undefined ||
701
- document.body.style.msTransition !== undefined ) {
702
- _.cssTransitions = true;
703
- }
872
+ _.animating = false;
704
873
 
705
- if (document.body.style.MozTransform !== undefined) _.animType = 'MozTransform';
706
- if (document.body.style.webkitTransform !== undefined) _.animType = 'webkitTransform';
707
- if (document.body.style.msTransform !== undefined) _.animType = 'msTransform';
874
+ _.currentSlide = index;
708
875
 
709
- _.transformsEnabled = (_.animType !== null);
876
+ _.setPosition();
710
877
 
711
- };
878
+ _.swipeLeft = null;
712
879
 
713
- Slick.prototype.setFade = function () {
880
+ _.updateDots();
714
881
 
715
- var _ = this, targetLeft;
882
+ _.updateArrows();
716
883
 
717
- _.slides.each(function (index,element) {
718
- targetLeft = (_.slideWidth * index) * -1;
719
- $(element).css({
720
- position: 'relative',
721
- left: targetLeft,
722
- top: 0,
723
- zIndex: 800,
724
- opacity: 0
725
- });
726
- });
884
+ if (_.options.autoplay === true && _.paused === false) {
885
+ _.autoPlay();
886
+ }
727
887
 
728
- $(_.slides.get(_.currentSlide)).css({
729
- zIndex: 900,
730
- opacity: 1
731
- });
888
+ _.setSlideClasses(_.currentSlide);
732
889
 
733
890
  };
734
891
 
735
- Slick.prototype.initArrowEvents = function () {
892
+ Slick.prototype.progressiveLazyLoad = function () {
736
893
 
737
- var _ = this;
894
+ var _ = this, imgCount, targetImage;
738
895
 
739
- if (_.options.arrows === true && _.slideCount > _.options.slidesToShow) {
740
- _.prevArrow.on('click.slick', {
741
- message: 'previous'
742
- }, _.changeSlide);
743
- _.nextArrow.on('click.slick', {
744
- message: 'next'
745
- }, _.changeSlide);
896
+ imgCount = $('img[data-lazy]').not('[src]').length;
897
+
898
+ if(imgCount > 0) {
899
+ targetImage = $($('img[data-lazy]', _.slider).not('[src]').get(0));
900
+ targetImage.attr('src', targetImage.attr('data-lazy')).removeClass('slick-loading').load(function(){
901
+ _.progressiveLazyLoad();
902
+ });
746
903
  }
747
904
 
748
905
  };
749
906
 
750
- Slick.prototype.initDotEvents = function () {
907
+ Slick.prototype.refresh = function () {
751
908
 
752
909
  var _ = this;
753
910
 
754
- if (_.options.dots === true && _.slideCount > _.options.slidesToShow) {
755
- $('li a', _.dots).on('click.slick', {
756
- message: 'index'
757
- }, _.changeSlide);
758
- }
911
+ _.destroy();
912
+
913
+ $.extend(_, _.initials);
914
+
915
+ _.init();
759
916
 
760
917
  };
761
918
 
762
- Slick.prototype.initializeEvents = function () {
919
+ Slick.prototype.reinit = function () {
763
920
 
764
921
  var _ = this;
765
922
 
923
+ _.slides = $(_.options.slide +
924
+ ':not(.slick-cloned)', _.slideTrack).addClass(
925
+ 'slick-slide');
926
+
927
+ _.slideCount = _.slides.length;
928
+
929
+ if(_.currentSlide >= _.slideCount && _.currentSlide !== 0) {
930
+ _.currentSlide = _.currentSlide - _.options.slidesToScroll;
931
+ }
932
+
933
+ _.setProps();
934
+
935
+ _.setupPlaceholders();
936
+
937
+ _.setupInfinite();
938
+
939
+ _.buildArrows();
940
+
941
+ _.updateArrows();
942
+
766
943
  _.initArrowEvents();
767
944
 
945
+ _.buildDots();
946
+
947
+ _.updateDots();
948
+
768
949
  _.initDotEvents();
769
950
 
770
- if (_.options.swipe === true) {
771
- _.list.on('touchstart.slick', {
772
- action: 'start',
773
- kind: 'touch'
774
- }, _.swipeHandler);
775
- _.list.on('touchmove.slick', {
776
- action: 'move',
777
- kind: 'touch'
778
- }, _.swipeHandler);
779
- _.list.on('touchend.slick', {
780
- action: 'end',
781
- kind: 'touch'
782
- }, _.swipeHandler);
783
- _.list.on('touchcancel.slick', {
784
- action: 'end',
785
- kind: 'touch'
786
- }, _.swipeHandler);
951
+ _.setSlideClasses(0);
952
+
953
+ _.setPosition();
954
+
955
+ if (_.options.onReInit !== null) {
956
+ _.options.onReInit.call(this, _);
787
957
  }
788
958
 
789
- if (_.options.draggable === true) {
790
- _.list.on('mousedown.slick', {
791
- action: 'start',
792
- kind: 'drag'
793
- }, _.swipeHandler);
794
- _.list.on('mousemove.slick', {
795
- action: 'move',
796
- kind: 'drag'
797
- }, _.swipeHandler);
798
- _.list.on('mouseup.slick', {
799
- action: 'end',
800
- kind: 'drag'
801
- }, _.swipeHandler);
802
- _.list.on('mouseleave.slick', {
803
- action: 'end',
804
- kind: 'drag'
805
- }, _.swipeHandler);
959
+ };
960
+
961
+ Slick.prototype.removeSlide = function (index, removeBefore) {
962
+
963
+ var _ = this;
964
+
965
+ if (typeof(index) === "boolean") {
966
+ removeBefore = index;
967
+ index = null;
806
968
  }
807
969
 
808
- if (_.options.pauseOnHover === true && _.options.autoplay === true) {
809
- _.list.on('mouseenter.slick', _.autoPlayClear);
810
- _.list.on('mouseleave.slick', _.autoPlay);
970
+ _.unload();
971
+
972
+ if (_.slideCount < 1) {
973
+ return false;
811
974
  }
812
975
 
813
- _.list.on('keydown.slick', _.keyHandler);
976
+ if (typeof(index) === "number") {
977
+ if (removeBefore === true) {
978
+ --index;
979
+ } else if (removeBefore === false) {
980
+ ++index;
981
+ }
982
+ } else {
983
+ if (removeBefore === true) {
984
+ index = 0;
985
+ } else {
986
+ index = $(_.slideTrack.children(this.options.slide)).length - 1;
987
+ }
988
+ }
814
989
 
815
- $(window).on('orientationchange.slick', function(){
816
- _.checkResponsive();
817
- _.setPosition();
818
- });
990
+ if (index < 0 || index >= $(_.slideTrack.children(this.options.slide)).length) {
991
+ _.reinit();
992
+ return false;
993
+ }
819
994
 
820
- $(window).resize(function () {
821
- if ($(window).width !== _.windowWidth) {
822
- clearTimeout(_.windowDelay);
823
- _.windowDelay = window.setTimeout(function () {
824
- _.windowWidth = $(window).width();
825
- _.checkResponsive();
826
- _.setPosition();
827
- }, 50);
828
- }
829
- });
995
+ $(_.slideTrack.children(this.options.slide).get(index)).remove();
830
996
 
831
- $(window).on('load.slick', _.setPosition);
997
+ _.slides = _.slideTrack.children(this.options.slide);
832
998
 
833
- };
999
+ _.slideTrack.children(this.options.slide).remove();
834
1000
 
835
- Slick.prototype.changeSlide = function (event) {
1001
+ _.slideTrack.append(_.slides);
836
1002
 
837
- var _ = this;
1003
+ _.reinit();
838
1004
 
839
- switch (event.data.message) {
1005
+ };
840
1006
 
841
- case 'previous':
842
- _.slideHandler(_.currentSlide - _.options
843
- .slidesToScroll);
844
- break;
1007
+ Slick.prototype.setCSS = function (position) {
845
1008
 
846
- case 'next':
847
- if ((_.options.placeholders === false && _.currentSlide +
848
- _.options.slidesToShow >= _.slideCount)) {
849
- return false;
850
- }
851
- _.slideHandler(_.currentSlide + _.options
852
- .slidesToScroll);
853
- break;
1009
+ var _ = this, positionProps = {}, x, y;
854
1010
 
855
- case 'index':
856
- _.slideHandler($(event.target).parent().index());
857
- break;
1011
+ x = _.positionProp == 'left' ? position + 'px' : '0px';
1012
+ y = _.positionProp == 'top' ? position + 'px' : '0px';
858
1013
 
859
- default:
860
- return false;
1014
+ positionProps[_.positionProp] = position;
1015
+
1016
+ if (_.transformsEnabled === false) {
1017
+ _.slideTrack.css(positionProps);
1018
+ } else {
1019
+ positionProps = {};
1020
+ if(_.cssTransitions === false) {
1021
+ positionProps[_.animType] = "translate(" + x + ", " + y + ")";
1022
+ _.slideTrack.css(positionProps);
1023
+ } else {
1024
+ positionProps[_.animType] = "translate3d(" + x + ", " + y + ", 0px)";
1025
+ _.slideTrack.css(positionProps);
1026
+ }
861
1027
  }
862
1028
 
863
1029
  };
864
1030
 
865
- Slick.prototype.updateDots = function () {
1031
+ Slick.prototype.setDimensions = function () {
866
1032
 
867
1033
  var _ = this;
868
1034
 
869
- if(_.dots !== null) {
1035
+ if(_.options.centerMode === true) {
1036
+ _.list.find('.slick-slide').width(_.slideWidth);
1037
+ } else {
1038
+ _.list.find('.slick-slide').width(_.slideWidth);
1039
+ }
870
1040
 
871
- _.dots.find('li').removeClass('slick-active');
872
- $(_.dots.find('li').get(_.currentSlide)).addClass(
873
- 'slick-active');
874
1041
 
1042
+ if (_.options.vertical === false) {
1043
+ _.slideTrack.width(Math.ceil((_.slideWidth * _
1044
+ .slider.find('.slick-slide').length)));
1045
+ if(_.options.centerMode === true) {
1046
+ _.list.css({padding: ('0px ' + _.options.centerPadding + 'px')});
1047
+ }
1048
+ } else {
1049
+ _.list.height(_.slides.first().outerHeight());
1050
+ _.slideTrack.height(Math.ceil((_.listHeight * _
1051
+ .slider.find('.slick-slide').length)));
1052
+ if(_.options.centerMode === true) {
1053
+ _.list.css({padding: (_.options.centerPadding + 'px 0px')});
1054
+ }
875
1055
  }
876
1056
 
877
1057
  };
878
1058
 
879
- Slick.prototype.updateArrows = function () {
1059
+ Slick.prototype.setFade = function () {
880
1060
 
881
- var _ = this;
1061
+ var _ = this, targetLeft;
882
1062
 
883
- if (_.options.arrows === true && _.options.infinite !==
884
- true && _.slideCount > _.options.slidesToShow) {
885
- if (_.currentSlide === 0) {
886
- _.prevArrow.addClass('slick-disabled');
887
- _.nextArrow.removeClass('slick-disabled');
888
- } else if (_.currentSlide >= (_.slideCount /
889
- _.options.slidesToScroll * _.options.slidesToShow
890
- ) - _.options.slidesToScroll) {
891
- _.nextArrow.addClass('slick-disabled');
892
- _.prevArrow.removeClass('slick-disabled');
893
- } else if (_.options.placeholders === false && _.currentSlide +
894
- _.options.slidesToShow >= _.slideCount) {
895
- _.nextArrow.addClass('slick-disabled');
896
- _.prevArrow.removeClass('slick-disabled');
1063
+ _.slides.each(function (index,element) {
1064
+ targetLeft = (_.slideWidth * index) * -1;
1065
+ $(element).css({
1066
+ position: 'relative',
1067
+ left: targetLeft,
1068
+ top: 0,
1069
+ zIndex: 800,
1070
+ opacity: 0
1071
+ });
1072
+ });
1073
+
1074
+ $(_.slides.get(_.currentSlide)).css({
1075
+ zIndex: 900,
1076
+ opacity: 1
1077
+ });
1078
+
1079
+ };
1080
+
1081
+ Slick.prototype.setPosition = function () {
1082
+
1083
+ var _ = this, targetPosition, targetSlide;
1084
+
1085
+ targetSlide = _.currentSlide;
1086
+
1087
+ _.setValues();
1088
+ _.setDimensions();
1089
+
1090
+ _.slideOffset = 0;
1091
+
1092
+ if (_.options.infinite === true) {
1093
+ if(_.slideCount > _.options.slidesToShow) {
1094
+ _.slideOffset = (_.slideWidth * _.options.slidesToShow) * -1;
1095
+ }
1096
+ }
1097
+
1098
+ if (_.options.centerMode === true) {
1099
+ _.slideOffset += _.slideWidth * Math.floor(_.options.slidesToShow / 2) - _.slideWidth;
1100
+ }
1101
+
1102
+ if (_.options.placeholders === false) {
1103
+ if(_.currentSlide + _.options.slidesToScroll >= _.slideCount - _.options.slidesToScroll) {
1104
+ _.slideOffset = _.slideOffset - ((_.slideWidth * _.placeholderOffset) * -1);
1105
+ }
1106
+ }
1107
+
1108
+ if (_.options.fade === false) {
1109
+ if (_.options.vertical === false) {
1110
+ targetPosition = ((targetSlide *
1111
+ _.slideWidth) * -1) + _.slideOffset;
897
1112
  } else {
898
- _.prevArrow.removeClass('slick-disabled');
899
- _.nextArrow.removeClass('slick-disabled');
1113
+ targetPosition = ((targetSlide *
1114
+ _.listHeight) * -1) - _.listHeight;
900
1115
  }
1116
+ _.setCSS(targetPosition);
1117
+ } else {
1118
+ _.setFade();
901
1119
  }
902
1120
 
903
1121
  };
904
1122
 
905
- Slick.prototype.fadeSlide = function (slideIndex, callback) {
1123
+ Slick.prototype.setProps = function () {
906
1124
 
907
1125
  var _ = this;
908
1126
 
909
- if(_.cssTransitions === false) {
910
-
911
- $(_.slides.get(slideIndex)).css({zIndex: 1000});
912
-
913
- $(_.slides.get(slideIndex)).animate({
914
- opacity: 1
915
- }, _.options.speed,_.options.easing, callback);
1127
+ _.positionProp = _.options.vertical === true ? 'top' : 'left';
916
1128
 
1129
+ if (_.positionProp === 'top') {
1130
+ _.slider.addClass('slick-vertical');
917
1131
  } else {
1132
+ _.slider.removeClass('slick-vertical');
1133
+ }
918
1134
 
919
- _.applyTransition(slideIndex);
1135
+ if ( document.body.style.WebkitTransition !== undefined ||
1136
+ document.body.style.MozTransition !== undefined ||
1137
+ document.body.style.msTransition !== undefined ) {
1138
+ _.cssTransitions = true;
1139
+ }
920
1140
 
921
- $(_.slides.get(slideIndex)).css({
922
- opacity: 1,
923
- zIndex: 1000
924
- });
1141
+ if (document.body.style.MozTransform !== undefined) _.animType = 'MozTransform';
1142
+ if (document.body.style.webkitTransform !== undefined) _.animType = 'webkitTransform';
1143
+ if (document.body.style.msTransform !== undefined) _.animType = 'msTransform';
925
1144
 
926
- if(callback) {
927
- setTimeout(function(){
1145
+ _.transformsEnabled = (_.animType !== null);
928
1146
 
929
- _.disableTransition(slideIndex);
1147
+ };
930
1148
 
931
- callback.call();
932
- }, _.options.speed);
933
- }
1149
+ Slick.prototype.setValues = function () {
934
1150
 
935
- }
1151
+ var _ = this;
1152
+
1153
+ _.listWidth = _.list.width();
1154
+ _.listHeight = _.list.height();
1155
+ _.slideWidth = Math.ceil(_.listWidth / _.options
1156
+ .slidesToShow);
936
1157
 
937
1158
  };
938
1159
 
939
- Slick.prototype.animateSlide = function (targetLeft,
940
- callback) {
1160
+ Slick.prototype.setSlideClasses = function (index) {
941
1161
 
942
- var animProps = {}, _ = this;
1162
+ var _ = this, centerOffset, allSlides, indexOffset;
943
1163
 
944
- if (_.transformsEnabled === false) {
945
- if (_.options.vertical === false) {
946
- _.slideTrack.animate({
947
- left: targetLeft
948
- }, _.options.speed,_.options.easing, callback);
1164
+ _.slider.find('.slick-slide').removeClass('slick-active').removeClass('slick-center');
1165
+ allSlides = _.slider.find('.slick-slide');
1166
+
1167
+ if (_.options.centerMode === true) {
1168
+
1169
+ centerOffset = Math.floor(_.options.slidesToShow / 2);
1170
+
1171
+ if(index >= centerOffset && index <= (_.slideCount - 1) - centerOffset) {
1172
+ _.slides.slice(index - centerOffset, index + centerOffset + 1).addClass('slick-active');
949
1173
  } else {
950
- _.slideTrack.animate({
951
- top: targetLeft
952
- }, _.options.speed,_.options.easing, callback);
1174
+ indexOffset = _.options.slidesToShow + index;
1175
+ allSlides.slice(indexOffset - centerOffset + 1, indexOffset + centerOffset + 2).addClass('slick-active');
953
1176
  }
954
1177
 
955
- } else {
1178
+ if(index === 0) {
1179
+ $(allSlides.get(allSlides.length - 1 - _.options.slidesToShow)).addClass('slick-center');
1180
+ } else if (index === _.slideCount - 1) {
1181
+ $(allSlides.get(_.options.slidesToShow)).addClass('slick-center');
1182
+ }
956
1183
 
957
- if(_.cssTransitions === false) {
1184
+ $(_.slides.get(index)).addClass('slick-center');
958
1185
 
959
- $({
960
- animStart: _.currentLeft
961
- }).animate({
962
- animStart: targetLeft
963
- }, {
964
- duration: _.options.speed,
965
- easing: _.options.easing,
966
- step: function (now) {
967
- if (_.options.vertical === false) {
968
- animProps[_.animType] = "translate(" +
969
- now + "px, 0px)";
970
- _.slideTrack.css(animProps);
971
- } else {
972
- animProps[_.animType] = "translate(0px," +
973
- now + "px,0px)";
974
- _.slideTrack.css(animProps);
975
- }
976
- },
977
- complete: function () {
978
- if (callback) {
979
- callback.call();
980
- }
981
- }
982
- });
1186
+ } else {
983
1187
 
1188
+ if(index > 0 && index < (_.slideCount - _.options.slidesToShow)) {
1189
+ _.slides.slice(index, index + _.options.slidesToShow).addClass('slick-active');
984
1190
  } else {
1191
+ indexOffset = _.options.slidesToShow + index;
1192
+ allSlides.slice(indexOffset, indexOffset + _.options.slidesToShow).addClass('slick-active');
1193
+ }
985
1194
 
986
- _.applyTransition();
1195
+ }
987
1196
 
988
- if (_.options.vertical === false) {
989
- animProps[_.animType] = "translate3d(" + targetLeft + "px, 0px, 0px)";
990
- } else {
991
- animProps[_.animType] = "translate3d(0px," + targetLeft + "px, 0px)";
992
- }
993
- _.slideTrack.css(animProps);
1197
+ if (_.options.lazyLoad === 'ondemand') {
1198
+ _.lazyLoad();
1199
+ }
994
1200
 
995
- if(callback) {
996
- setTimeout(function(){
1201
+ };
997
1202
 
998
- _.disableTransition();
1203
+ Slick.prototype.setupInfinite = function () {
999
1204
 
1000
- callback.call();
1001
- }, _.options.speed);
1002
- }
1205
+ var _ = this, i, slideIndex, infiniteCount;
1003
1206
 
1004
- }
1207
+ if (_.options.infinite === true && _.options.fade === false) {
1005
1208
 
1006
- }
1209
+ slideIndex = null;
1007
1210
 
1008
- };
1211
+ if (_.slideCount > _.options.slidesToShow) {
1009
1212
 
1010
- Slick.prototype.setSlideClasses = function (index) {
1011
- var _ = this;
1012
- _.slides.removeClass('slick-active');
1013
- $(_.slides.get(index)).addClass('slick-active');
1014
- };
1213
+ if(_.options.centerMode === true) {
1214
+ infiniteCount = _.options.slidesToShow + 1;
1215
+ } else {
1216
+ infiniteCount = _.options.slidesToShow;
1217
+ }
1015
1218
 
1016
- Slick.prototype.postSlide = function (index) {
1219
+ for (i = _.slideCount; i > (_.slideCount -
1220
+ infiniteCount); i -= 1) {
1221
+ slideIndex = i - 1;
1222
+ $(_.slides[slideIndex]).clone().prependTo(
1223
+ _.slideTrack).addClass('slick-cloned');
1224
+ }
1225
+ for (i = 0; i < infiniteCount; i += 1) {
1226
+ slideIndex = i;
1227
+ $(_.slides[slideIndex]).clone().appendTo(
1228
+ _.slideTrack).addClass('slick-cloned');
1229
+ }
1017
1230
 
1018
- var _ = this;
1231
+ }
1019
1232
 
1020
- if (_.options.onAfterChange !== null && index !== _.currentSlide) {
1021
- _.options.onAfterChange.call(_, index);
1022
1233
  }
1023
1234
 
1024
- _.animating = false;
1235
+ };
1025
1236
 
1026
- _.currentSlide = index;
1237
+ Slick.prototype.setupPlaceholders = function () {
1027
1238
 
1028
- _.setPosition();
1239
+ var _ = this, i, placeholders;
1029
1240
 
1030
- _.swipeLeft = null;
1241
+ if(_.options.fade === true || _.options.vertical === true) {
1242
+ _.options.slidesToShow = 1;
1243
+ _.options.slidesToScroll = 1;
1244
+ _.options.centerMode = false;
1245
+ }
1031
1246
 
1032
- _.updateDots();
1247
+ if(_.options.placeholders === false) {
1248
+ _.options.infinite = false;
1249
+ _.placeholderOffset = _.slideCount % _.options.slidesToScroll;
1250
+ return false;
1251
+ }
1033
1252
 
1034
- _.updateArrows();
1253
+ if ((_.slideCount % _.options.slidesToScroll) !==
1254
+ 0 && _.slideCount > _.options.slidesToShow) {
1035
1255
 
1036
- if (_.options.autoplay === true && _.paused === false) {
1037
- _.autoPlay();
1256
+ placeholders = Math.abs(_.options.slidesToScroll -
1257
+ (_.slideCount % _.options.slidesToScroll)
1258
+ );
1259
+ for (i = 0; i < placeholders; i += 1) {
1260
+ $('<div/>').appendTo(_.slideTrack).addClass(
1261
+ 'slick-slide slick-placeholder');
1262
+ }
1263
+ _.slides = $('.slick-slide:not(.slick-cloned)',
1264
+ _.slider);
1265
+ _.slideCount = _.slides.length;
1038
1266
  }
1039
1267
 
1040
- _.setSlideClasses(_.currentSlide);
1041
-
1042
1268
  };
1043
1269
 
1044
1270
  Slick.prototype.slideHandler = function (index) {
1045
1271
 
1046
- var targetSlide, animSlide, slideLeft, targetLeft = null, _ = this;
1272
+ var targetSlide, animSlide, slideLeft, targetLeft = null,
1273
+ targetOffset, _ = this;
1047
1274
 
1048
1275
  if(_.animating === true) {
1049
1276
  return false;
1050
1277
  }
1051
1278
 
1052
1279
  targetSlide = index;
1280
+ targetOffset = _.slideOffset;
1053
1281
 
1054
- if(_.options.vertical === false) {
1055
- targetLeft = ((targetSlide * _.slideWidth) * -1) + _.slideOffset;
1056
- slideLeft = ((_.currentSlide * _.slideWidth) * -1) + _.slideOffset;
1057
- if (_.options.placeholders === false && targetSlide +
1058
- _.options.slidesToShow >= _.slideCount) {
1059
- targetLeft = (((_.slideCount - _.options.slidesToShow) * _.slideWidth) * -1) + _.slideOffset;
1282
+ if(_.options.placeholders === false) {
1283
+ if (_.currentSlide >= _.slideCount - _.options.slidesToShow) {
1284
+ if (targetSlide >= _.slideCount - _.options.slidesToShow) {
1285
+ targetSlide = _.currentSlide;
1286
+ } else {
1287
+ targetOffset = 0;
1288
+ }
1289
+ } else if (targetSlide + _.options.slidesToScroll >= _.slideCount -
1290
+ _.options.slidesToScroll) {
1291
+ targetOffset = ((_.placeholderOffset * _.slideWidth));
1060
1292
  }
1293
+ }
1294
+
1295
+ if(_.options.vertical === false) {
1296
+ targetLeft = ((targetSlide * _.slideWidth) * -1) + targetOffset;
1297
+ slideLeft = ((_.currentSlide * _.slideWidth) * -1) + targetOffset;
1061
1298
  } else {
1062
1299
  targetLeft = ((targetSlide * _.listHeight) * -1) - _.listHeight;
1063
1300
  slideLeft = ((_.currentSlide * _.listHeight) * -1) - _.listHeight;
1064
- if (_.options.placeholders === false && targetSlide +
1065
- _.options.slidesToShow >= _.slideCount) {
1066
- targetLeft = (((_.slideCount - _.options.slidesToShow) * _.listHeight) * -1) - _.listHeight;
1067
- }
1068
1301
  }
1069
1302
 
1070
1303
  if (_.options.infinite === false && (index < 0 || index > (_.slideCount -1))) {
@@ -1085,9 +1318,6 @@
1085
1318
  animSlide = _.slideCount - _.options.slidesToScroll;
1086
1319
  } else if (targetSlide > (_.slideCount - 1)) {
1087
1320
  animSlide = 0;
1088
- } else if (_.options.placeholders === false && targetSlide +
1089
- _.options.slidesToShow >= _.slideCount) {
1090
- animSlide = _.slideCount - _.options.slidesToShow;
1091
1321
  } else {
1092
1322
  animSlide = targetSlide;
1093
1323
  }
@@ -1095,7 +1325,7 @@
1095
1325
  _.animating = true;
1096
1326
 
1097
1327
  if (_.options.onBeforeChange !== null && index !== _.currentSlide) {
1098
- _.options.onBeforeChange.call(_, animSlide);
1328
+ _.options.onBeforeChange.call(this, _, _.currentSlide);
1099
1329
  }
1100
1330
 
1101
1331
  if (_.options.fade === true) {
@@ -1110,106 +1340,51 @@
1110
1340
 
1111
1341
  };
1112
1342
 
1113
- Slick.prototype.setCSS = function (position) {
1114
-
1115
- var _ = this, positionProps = {}, x, y;
1116
-
1117
- x = _.positionProp == 'left' ? position + 'px' : '0px';
1118
- y = _.positionProp == 'top' ? position + 'px' : '0px';
1119
-
1120
- positionProps[_.positionProp] = position;
1121
-
1122
- if (_.transformsEnabled === false) {
1123
- _.slideTrack.css(positionProps);
1124
- } else {
1125
- positionProps = {};
1126
- if(_.cssTransitions === false) {
1127
- positionProps[_.animType] = "translate(" + x + ", " + y + ")";
1128
- _.slideTrack.css(positionProps);
1129
- } else {
1130
- positionProps[_.animType] = "translate3d(" + x + ", " + y + ", 0px)";
1131
- _.slideTrack.css(positionProps);
1132
- }
1133
- }
1134
-
1135
- };
1136
-
1137
- Slick.prototype.swipeStart = function (event) {
1138
-
1139
- var _ = this, touches;
1140
-
1141
-
1142
- if (_.touchObject.fingerCount !== 1 || _.slideCount <= _.options.slidesToShow) {
1143
- _.touchObject = {};
1144
- return false;
1145
- }
1146
-
1147
- if(event.originalEvent !== undefined && event.originalEvent.touches !== undefined) {
1148
- touches = event.originalEvent.touches[0];
1149
- }
1150
-
1151
- _.touchObject.startX = _.touchObject.curX = touches !== undefined ? touches.pageX : event.clientX;
1152
- _.touchObject.startY = _.touchObject.curY = touches !== undefined ? touches.pageY : event.clientY;
1153
-
1154
- _.list.addClass('dragging');
1155
-
1156
- };
1157
-
1158
- Slick.prototype.swipeMove = function (event) {
1159
-
1160
- var _ = this, curLeft, swipeDirection, positionOffset, touches;
1343
+ Slick.prototype.startLoad = function () {
1161
1344
 
1162
- touches = event.originalEvent !== undefined ? event.originalEvent.touches : null;
1345
+ var _ = this;
1163
1346
 
1164
- curLeft = _.options.vertical === false ? ((_.currentSlide * _.slideWidth) * -1) +
1165
- _.slideOffset : ((_.currentSlide * _.listHeight) * -1) -
1166
- _.listHeight;
1347
+ if (_.options.arrows === true && _.slideCount > _.options.slidesToShow) {
1167
1348
 
1168
- if (_.options.placeholders === false && _.currentSlide +
1169
- _.options.slidesToShow >= _.slideCount) {
1170
- curLeft = (((_.slideCount - _.options.slidesToShow) * _.slideWidth) * -1) + _.slideOffset;
1171
- }
1349
+ _.prevArrow.hide();
1350
+ _.nextArrow.hide();
1172
1351
 
1173
- if((!_.list.hasClass('dragging') && event.data.kind === 'drag') ||
1174
- touches && touches.length !== 1){
1175
- return false;
1176
1352
  }
1177
1353
 
1178
- _.touchObject.curX = touches !== undefined ? touches[0].pageX : event.clientX;
1179
- _.touchObject.curY = touches !== undefined ? touches[0].pageY : event.clientY;
1180
-
1181
- _.touchObject.swipeLength = Math.round(Math.sqrt(
1182
- Math.pow(_.touchObject.curX - _.touchObject.startX, 2)));
1354
+ if (_.options.dots === true && _.slideCount > _.options.slidesToShow) {
1183
1355
 
1184
- swipeDirection = _.swipeDirection();
1356
+ _.dots.hide();
1185
1357
 
1186
- if (swipeDirection === 'vertical') {
1187
- return false;
1188
1358
  }
1189
1359
 
1190
- if(event.originalEvent !== undefined) {
1191
- event.preventDefault();
1192
- }
1360
+ _.slider.addClass('slick-loading');
1193
1361
 
1194
- positionOffset = _.touchObject.curX > _.touchObject.startX ? 1 : -1;
1362
+ };
1195
1363
 
1196
- if(_.options.vertical === false) {
1197
- _.swipeLeft = curLeft + _.touchObject.swipeLength * positionOffset;
1198
- } else {
1199
- _.swipeLeft = curLeft + (_.touchObject
1200
- .swipeLength * (_.listHeight / _.listWidth)) * positionOffset;
1201
- }
1364
+ Slick.prototype.swipeDirection = function () {
1202
1365
 
1203
- if(_.options.fade === true || _.options.touchMove === false) {
1204
- return false;
1366
+ var xDist, yDist, r, swipeAngle, _ = this;
1367
+
1368
+ xDist = _.touchObject.startX - _.touchObject.curX;
1369
+ yDist = _.touchObject.startY - _.touchObject.curY;
1370
+ r = Math.atan2(yDist, xDist);
1371
+
1372
+ swipeAngle = Math.round(r * 180 / Math.PI);
1373
+ if (swipeAngle < 0) {
1374
+ swipeAngle = 360 - Math.abs(swipeAngle);
1205
1375
  }
1206
1376
 
1207
- if (_.animating === true) {
1208
- _.swipeLeft = null;
1209
- return false;
1377
+ if ((swipeAngle <= 45) && (swipeAngle >= 0)) {
1378
+ return 'left';
1379
+ }
1380
+ if ((swipeAngle <= 360) && (swipeAngle >= 315)) {
1381
+ return 'left';
1382
+ }
1383
+ if ((swipeAngle >= 135) && (swipeAngle <= 225)) {
1384
+ return 'right';
1210
1385
  }
1211
1386
 
1212
- _.setCSS(_.swipeLeft);
1387
+ return 'vertical';
1213
1388
 
1214
1389
  };
1215
1390
 
@@ -1219,6 +1394,10 @@
1219
1394
 
1220
1395
  _.list.removeClass('dragging');
1221
1396
 
1397
+ if(_.touchObject.curX === undefined) {
1398
+ return false;
1399
+ }
1400
+
1222
1401
  if ((_.touchObject.fingerCount !== 0) && event.data.kind !== 'drag') {
1223
1402
  _.touchObject = {};
1224
1403
  return false;
@@ -1226,6 +1405,13 @@
1226
1405
 
1227
1406
  if (_.touchObject.swipeLength >= _.touchObject.minSwipe) {
1228
1407
 
1408
+ $(event.target).on("click.slick", function (event) {
1409
+ event.stopImmediatePropagation();
1410
+ event.stopPropagation();
1411
+ event.preventDefault();
1412
+ $(event.target).off("click.slick");
1413
+ });
1414
+
1229
1415
  switch (_.swipeDirection()) {
1230
1416
  case 'left':
1231
1417
  _.slideHandler(_.currentSlide + _.options.slidesToScroll);
@@ -1245,18 +1431,6 @@
1245
1431
 
1246
1432
  };
1247
1433
 
1248
- Slick.prototype.keyHandler = function (event) {
1249
-
1250
- var _ = this;
1251
-
1252
- if (event.keyCode === 37) {
1253
- _.changeSlide({data: {message: 'previous'}});
1254
- } else if (event.keyCode === 39) {
1255
- _.changeSlide({data: {message: 'next'}});
1256
- }
1257
-
1258
- };
1259
-
1260
1434
  Slick.prototype.swipeHandler = function (event) {
1261
1435
 
1262
1436
  var _ = this;
@@ -1287,106 +1461,106 @@
1287
1461
 
1288
1462
  };
1289
1463
 
1290
- Slick.prototype.swipeDirection = function () {
1464
+ Slick.prototype.swipeMove = function (event) {
1291
1465
 
1292
- var xDist, yDist, r, swipeAngle, _ = this;
1466
+ var _ = this, curLeft, swipeDirection, positionOffset, touches;
1293
1467
 
1294
- xDist = _.touchObject.startX - _.touchObject.curX;
1295
- yDist = _.touchObject.startY - _.touchObject.curY;
1296
- r = Math.atan2(yDist, xDist);
1468
+ touches = event.originalEvent !== undefined ? event.originalEvent.touches : null;
1297
1469
 
1298
- swipeAngle = Math.round(r * 180 / Math.PI);
1299
- if (swipeAngle < 0) {
1300
- swipeAngle = 360 - Math.abs(swipeAngle);
1301
- }
1470
+ curLeft = _.options.vertical === false ? ((_.currentSlide * _.slideWidth) * -1) +
1471
+ _.slideOffset : ((_.currentSlide * _.listHeight) * -1) -
1472
+ _.listHeight;
1302
1473
 
1303
- if ((swipeAngle <= 45) && (swipeAngle >= 0)) {
1304
- return 'left';
1305
- }
1306
- if ((swipeAngle <= 360) && (swipeAngle >= 315)) {
1307
- return 'left';
1308
- }
1309
- if ((swipeAngle >= 135) && (swipeAngle <= 225)) {
1310
- return 'right';
1474
+ if (_.options.placeholders === false && _.currentSlide +
1475
+ _.options.slidesToShow >= _.slideCount) {
1476
+ curLeft = ((_.currentSlide * _.slideWidth) * -1) + _.slideOffset;
1311
1477
  }
1312
1478
 
1313
- return 'vertical';
1479
+ if((!_.list.hasClass('dragging') && event.data.kind === 'drag') ||
1480
+ touches && touches.length !== 1){
1481
+ return false;
1482
+ }
1314
1483
 
1315
- };
1484
+ _.touchObject.curX = touches !== undefined ? touches[0].pageX : event.clientX;
1485
+ _.touchObject.curY = touches !== undefined ? touches[0].pageY : event.clientY;
1316
1486
 
1317
- Slick.prototype.refresh = function () {
1487
+ _.touchObject.swipeLength = Math.round(Math.sqrt(
1488
+ Math.pow(_.touchObject.curX - _.touchObject.startX, 2)));
1318
1489
 
1319
- var _ = this;
1490
+ swipeDirection = _.swipeDirection();
1320
1491
 
1321
- _.destroy();
1492
+ if (swipeDirection === 'vertical') {
1493
+ return false;
1494
+ }
1322
1495
 
1323
- $.extend(_, _.initials);
1496
+ if(event.originalEvent !== undefined) {
1497
+ event.preventDefault();
1498
+ }
1324
1499
 
1325
- _.init();
1500
+ positionOffset = _.touchObject.curX > _.touchObject.startX ? 1 : -1;
1326
1501
 
1327
- };
1502
+ if(_.options.vertical === false) {
1503
+ _.swipeLeft = curLeft + _.touchObject.swipeLength * positionOffset;
1504
+ } else {
1505
+ _.swipeLeft = curLeft + (_.touchObject
1506
+ .swipeLength * (_.listHeight / _.listWidth)) * positionOffset;
1507
+ }
1328
1508
 
1329
- Slick.prototype.unload = function () {
1330
- var _ = this;
1331
- $('.slick-cloned', _.slider).remove();
1332
- $('.slick-placeholder', _.slider).remove();
1333
- if (_.dots) {
1334
- _.dots.remove();
1509
+ if(_.options.fade === true || _.options.touchMove === false) {
1510
+ return false;
1335
1511
  }
1336
- if (_.prevArrow) {
1337
- _.prevArrow.remove();
1338
- _.nextArrow.remove();
1512
+
1513
+ if (_.animating === true) {
1514
+ _.swipeLeft = null;
1515
+ return false;
1339
1516
  }
1340
- _.slides.removeClass(
1341
- 'slick-slide slick-active slick-visible').removeAttr('style');
1342
- };
1343
1517
 
1344
- Slick.prototype.reinit = function () {
1518
+ _.setCSS(_.swipeLeft);
1345
1519
 
1346
- var _ = this;
1520
+ };
1347
1521
 
1348
- _.slides = $(_.options.slide +
1349
- ':not(.slick-cloned)', _.slideTrack).addClass(
1350
- 'slick-slide');
1522
+ Slick.prototype.swipeStart = function (event) {
1351
1523
 
1352
- _.slideCount = _.slides.length;
1524
+ var _ = this, touches;
1353
1525
 
1354
- if(_.currentSlide >= _.slideCount && _.currentSlide !== 0) {
1355
- _.currentSlide = _.currentSlide - _.options.slidesToScroll;
1526
+ if (_.touchObject.fingerCount !== 1 || _.slideCount <= _.options.slidesToShow) {
1527
+ _.touchObject = {};
1528
+ return false;
1356
1529
  }
1357
1530
 
1358
- _.setProps();
1531
+ if(event.originalEvent !== undefined && event.originalEvent.touches !== undefined) {
1532
+ touches = event.originalEvent.touches[0];
1533
+ }
1359
1534
 
1360
- _.setupPlaceholders();
1535
+ _.touchObject.startX = _.touchObject.curX = touches !== undefined ? touches.pageX : event.clientX;
1536
+ _.touchObject.startY = _.touchObject.curY = touches !== undefined ? touches.pageY : event.clientY;
1361
1537
 
1362
- _.setupInfinite();
1538
+ _.list.addClass('dragging');
1363
1539
 
1364
- _.buildArrows();
1540
+ };
1365
1541
 
1366
- _.updateArrows();
1542
+ Slick.prototype.unfilterSlides = function () {
1367
1543
 
1368
- _.initArrowEvents();
1544
+ var _ = this;
1369
1545
 
1370
- _.buildDots();
1546
+ if(_.slidesCache !== null) {
1371
1547
 
1372
- _.updateDots();
1548
+ _.unload();
1373
1549
 
1374
- _.initDotEvents();
1550
+ _.slideTrack.children(this.options.slide).remove();
1375
1551
 
1376
- _.setSlideClasses(0);
1552
+ _.slidesCache.appendTo(_.slideTrack);
1377
1553
 
1378
- _.setPosition();
1554
+ _.reinit();
1555
+
1556
+ }
1379
1557
 
1380
1558
  };
1381
1559
 
1382
- Slick.prototype.destroy = function () {
1560
+ Slick.prototype.unload = function () {
1383
1561
 
1384
1562
  var _ = this;
1385
1563
 
1386
- _.autoPlayClear();
1387
-
1388
- _.touchObject = {};
1389
-
1390
1564
  $('.slick-cloned', _.slider).remove();
1391
1565
  $('.slick-placeholder', _.slider).remove();
1392
1566
  if (_.dots) {
@@ -1396,55 +1570,74 @@
1396
1570
  _.prevArrow.remove();
1397
1571
  _.nextArrow.remove();
1398
1572
  }
1399
- _.slides.unwrap().unwrap();
1400
1573
  _.slides.removeClass(
1401
1574
  'slick-slide slick-active slick-visible').removeAttr('style');
1402
- _.slider.removeClass('slick-slider');
1403
- _.slider.removeClass('slick-initialized');
1404
1575
 
1405
1576
  };
1406
1577
 
1407
- $.fn.slick = function (options) {
1578
+ Slick.prototype.updateArrows = function () {
1579
+
1408
1580
  var _ = this;
1409
- return _.each(function (index, element) {
1410
1581
 
1411
- element.slick = new Slick(element, options);
1582
+ if (_.options.arrows === true && _.options.infinite !==
1583
+ true && _.slideCount > _.options.slidesToShow) {
1584
+ if (_.currentSlide === 0) {
1585
+ _.prevArrow.addClass('slick-disabled');
1586
+ _.nextArrow.removeClass('slick-disabled');
1587
+ } else if (_.currentSlide >= (_.slideCount /
1588
+ _.options.slidesToScroll * _.options.slidesToShow
1589
+ ) - _.options.slidesToScroll) {
1590
+ _.nextArrow.addClass('slick-disabled');
1591
+ _.prevArrow.removeClass('slick-disabled');
1592
+ } else if (_.options.placeholders === false && _.currentSlide +
1593
+ _.options.slidesToShow >= _.slideCount) {
1594
+ _.nextArrow.addClass('slick-disabled');
1595
+ _.prevArrow.removeClass('slick-disabled');
1596
+ } else {
1597
+ _.prevArrow.removeClass('slick-disabled');
1598
+ _.nextArrow.removeClass('slick-disabled');
1599
+ }
1600
+ }
1412
1601
 
1413
- });
1414
1602
  };
1415
1603
 
1416
- $.fn.slickAdd = function (slide) {
1604
+ Slick.prototype.updateDots = function () {
1605
+
1417
1606
  var _ = this;
1418
- return _.each(function (index, element) {
1419
1607
 
1420
- element.slick.addSlide(slide);
1608
+ if(_.dots !== null) {
1609
+
1610
+ _.dots.find('li').removeClass('slick-active');
1611
+ $(_.dots.find('li').get(_.currentSlide)).addClass(
1612
+ 'slick-active');
1613
+
1614
+ }
1421
1615
 
1422
- });
1423
1616
  };
1424
1617
 
1425
- $.fn.slickRemove = function (slide) {
1618
+ $.fn.slick = function (options) {
1426
1619
  var _ = this;
1427
1620
  return _.each(function (index, element) {
1428
1621
 
1429
- element.slick.removeSlide(slide);
1622
+ element.slick = new Slick(element, options);
1430
1623
 
1431
1624
  });
1432
1625
  };
1433
1626
 
1434
- $.fn.slickFilter = function (filter) {
1627
+ $.fn.slickAdd = function (slide, slideIndex, addBefore) {
1435
1628
  var _ = this;
1436
1629
  return _.each(function (index, element) {
1437
1630
 
1438
- element.slick.filterSlides(filter);
1631
+ element.slick.addSlide(slide, slideIndex, addBefore);
1439
1632
 
1440
1633
  });
1441
1634
  };
1442
1635
 
1443
- $.fn.slickUnfilter = function () {
1636
+ $.fn.slickFilter = function (filter) {
1444
1637
  var _ = this;
1445
1638
  return _.each(function (index, element) {
1446
1639
 
1447
- element.slick.unfilterSlides();
1640
+ element.slick.filterSlides(filter);
1448
1641
 
1449
1642
  });
1450
1643
  };
@@ -1467,31 +1660,40 @@
1467
1660
  });
1468
1661
  };
1469
1662
 
1470
- $.fn.slickPrev = function () {
1663
+ $.fn.slickPause = function () {
1471
1664
  var _ = this;
1472
1665
  return _.each(function (index, element) {
1473
1666
 
1474
- element.slick.changeSlide({data: {message: 'previous'}});
1667
+ element.slick.autoPlayClear();
1668
+ element.slick.paused = true;
1475
1669
 
1476
1670
  });
1477
1671
  };
1478
1672
 
1479
- $.fn.slickPause = function () {
1673
+ $.fn.slickPlay = function () {
1480
1674
  var _ = this;
1481
1675
  return _.each(function (index, element) {
1482
1676
 
1483
- element.slick.autoPlayClear();
1484
- element.slick.paused = true;
1677
+ element.slick.paused = false;
1678
+ element.slick.autoPlay();
1485
1679
 
1486
1680
  });
1487
1681
  };
1488
1682
 
1489
- $.fn.slickPlay = function () {
1683
+ $.fn.slickPrev = function () {
1490
1684
  var _ = this;
1491
1685
  return _.each(function (index, element) {
1492
1686
 
1493
- element.slick.paused = false;
1494
- element.slick.autoPlay();
1687
+ element.slick.changeSlide({data: {message: 'previous'}});
1688
+
1689
+ });
1690
+ };
1691
+
1692
+ $.fn.slickRemove = function (slideIndex, removeBefore) {
1693
+ var _ = this;
1694
+ return _.each(function (index, element) {
1695
+
1696
+ element.slick.removeSlide(slideIndex, removeBefore);
1495
1697
 
1496
1698
  });
1497
1699
  };
@@ -1510,6 +1712,15 @@
1510
1712
  });
1511
1713
  };
1512
1714
 
1715
+ $.fn.slickUnfilter = function () {
1716
+ var _ = this;
1717
+ return _.each(function (index, element) {
1718
+
1719
+ element.slick.unfilterSlides();
1720
+
1721
+ });
1722
+ };
1723
+
1513
1724
  $.fn.unslick = function () {
1514
1725
  var _ = this;
1515
1726
  return _.each(function (index, element) {