jquery-slick-rails 1.3.11 → 1.3.14

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: 73366c4466a5e2a66fc85461ba8c9646f3fd9d41
4
- data.tar.gz: c6894ed8d2c3f747b57d5b48f5f52ec2b8d773b6
3
+ metadata.gz: 71a7df851aafb6e92c1c4fee25fc46283ea598a7
4
+ data.tar.gz: 0cd2a74adad37995d39316883733a53749f53e39
5
5
  SHA512:
6
- metadata.gz: f94e2a508105ae8570cbc6481d3c1a39287bf6cdab4d0e4307d6a059d1bb5b69625523cd2e12e72ba0a928082b109a8ffd2b5346a4dc5b5f6c8e07bd89fcd305
7
- data.tar.gz: 41ff68322cb76e5a9284aebd90d237a7592ae26e176c02f484e68478daf07f2e4ec0f9fd0642c26e9b3bfc01c8ced682d229dda416ef3c3e0ad0ed6f64a975b3
6
+ metadata.gz: 295f75a98638e5338f105baa720b4828998aca0a75a27b1140b9df9bd34fe4e903f00f994b7aea884ca0decad0f47cb6e4d21ac327d62364fc012f27791ec4fc
7
+ data.tar.gz: d46ee6eea68b798cdb95599ecb4bd9cdf2558f559d85a3181a013435aa2f97ad144a97a4a7521deef6c16741534c54fc5b5c0920c8b0f5d6599003935864e60c
@@ -1,3 +1,3 @@
1
1
  module JquerySlickRails
2
- VERSION = "1.3.11"
2
+ VERSION = "1.3.14"
3
3
  end
@@ -6,7 +6,7 @@
6
6
  |___/_|_|\___|_|\_(_)/ |___/
7
7
  |__/
8
8
 
9
- Version: 1.3.11
9
+ Version: 1.3.14
10
10
  Author: Ken Wheeler
11
11
  Website: http://kenwheeler.github.io
12
12
  Docs: http://kenwheeler.github.io/slick
@@ -64,19 +64,22 @@
64
64
  fade: false,
65
65
  focusOnSelect: false,
66
66
  infinite: true,
67
+ initialSlide: 0,
67
68
  lazyLoad: 'ondemand',
68
69
  onBeforeChange: null,
69
70
  onAfterChange: null,
70
71
  onInit: null,
71
72
  onReInit: null,
73
+ onSetPosition: null,
72
74
  pauseOnHover: true,
73
75
  pauseOnDotsHover: false,
76
+ respondTo: 'window',
74
77
  responsive: null,
75
78
  rtl: false,
76
79
  slide: 'div',
77
80
  slidesToShow: 1,
78
81
  slidesToScroll: 1,
79
- speed: 300,
82
+ speed: 500,
80
83
  swipe: true,
81
84
  swipeToSlide: false,
82
85
  touchMove: true,
@@ -91,8 +94,9 @@
91
94
  animating: false,
92
95
  dragging: false,
93
96
  autoPlayTimer: null,
94
- currentSlide: 0,
97
+ currentDirection: 0,
95
98
  currentLeft: null,
99
+ currentSlide: 0,
96
100
  direction: 1,
97
101
  $dots: null,
98
102
  listWidth: null,
@@ -122,6 +126,8 @@
122
126
  _.cssTransitions = false;
123
127
  _.paused = false;
124
128
  _.positionProp = null;
129
+ _.respondTo = null;
130
+ _.shouldClick = true;
125
131
  _.$slider = $(element);
126
132
  _.$slidesCache = null;
127
133
  _.transformType = null;
@@ -131,10 +137,13 @@
131
137
 
132
138
  _.options = $.extend({}, _.defaults, settings);
133
139
 
140
+ _.currentSlide = _.options.initialSlide;
141
+
134
142
  _.originalSettings = _.options;
135
143
  responsiveSettings = _.options.responsive || null;
136
144
 
137
145
  if (responsiveSettings && responsiveSettings.length > -1) {
146
+ _.respondTo = _.options.respondTo || "window";
138
147
  for (breakpoint in responsiveSettings) {
139
148
  if (responsiveSettings.hasOwnProperty(breakpoint)) {
140
149
  _.breakpoints.push(responsiveSettings[
@@ -152,6 +161,7 @@
152
161
  _.autoPlay = $.proxy(_.autoPlay, _);
153
162
  _.autoPlayClear = $.proxy(_.autoPlayClear, _);
154
163
  _.changeSlide = $.proxy(_.changeSlide, _);
164
+ _.clickHandler = $.proxy(_.clickHandler, _);
155
165
  _.selectHandler = $.proxy(_.selectHandler, _);
156
166
  _.setPosition = $.proxy(_.setPosition, _);
157
167
  _.swipeHandler = $.proxy(_.swipeHandler, _);
@@ -168,6 +178,8 @@
168
178
 
169
179
  _.init();
170
180
 
181
+ _.checkResponsive();
182
+
171
183
  }
172
184
 
173
185
  return Slick;
@@ -339,7 +351,6 @@
339
351
  Slick.prototype.autoPlayClear = function() {
340
352
 
341
353
  var _ = this;
342
-
343
354
  if (_.autoPlayTimer) {
344
355
  clearInterval(_.autoPlayTimer);
345
356
  }
@@ -458,9 +469,6 @@
458
469
 
459
470
  if (_.options.centerMode === true) {
460
471
  _.options.slidesToScroll = 1;
461
- if (_.options.slidesToShow % 2 === 0) {
462
- _.options.slidesToShow = 3;
463
- }
464
472
  }
465
473
 
466
474
  $('img[data-lazy]', _.$slider).not('[src]').addClass('slick-loading');
@@ -488,7 +496,16 @@
488
496
  Slick.prototype.checkResponsive = function() {
489
497
 
490
498
  var _ = this,
491
- breakpoint, targetBreakpoint;
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
+ }
492
509
 
493
510
  if (_.originalSettings.responsive && _.originalSettings
494
511
  .responsive.length > -1 && _.originalSettings.responsive !== null) {
@@ -497,10 +514,8 @@
497
514
 
498
515
  for (breakpoint in _.breakpoints) {
499
516
  if (_.breakpoints.hasOwnProperty(breakpoint)) {
500
- if ($(window).width() < _.breakpoints[
501
- breakpoint]) {
502
- targetBreakpoint = _.breakpoints[
503
- breakpoint];
517
+ if (respondToWidth < _.breakpoints[breakpoint]) {
518
+ targetBreakpoint = _.breakpoints[breakpoint];
504
519
  }
505
520
  }
506
521
  }
@@ -510,14 +525,14 @@
510
525
  if (targetBreakpoint !== _.activeBreakpoint) {
511
526
  _.activeBreakpoint =
512
527
  targetBreakpoint;
513
- _.options = $.extend({}, _.options,
528
+ _.options = $.extend({}, _.originalSettings,
514
529
  _.breakpointSettings[
515
530
  targetBreakpoint]);
516
531
  _.refresh();
517
532
  }
518
533
  } else {
519
534
  _.activeBreakpoint = targetBreakpoint;
520
- _.options = $.extend({}, _.options,
535
+ _.options = $.extend({}, _.originalSettings,
521
536
  _.breakpointSettings[
522
537
  targetBreakpoint]);
523
538
  _.refresh();
@@ -525,8 +540,7 @@
525
540
  } else {
526
541
  if (_.activeBreakpoint !== null) {
527
542
  _.activeBreakpoint = null;
528
- _.options = $.extend({}, _.options,
529
- _.originalSettings);
543
+ _.options = _.originalSettings;
530
544
  _.refresh();
531
545
  }
532
546
  }
@@ -535,11 +549,11 @@
535
549
 
536
550
  };
537
551
 
538
- Slick.prototype.changeSlide = function(event) {
552
+ Slick.prototype.changeSlide = function(event, dontAnimate) {
539
553
 
540
554
  var _ = this,
541
555
  $target = $(event.target),
542
- indexOffset, slideOffset, unevenOffset;
556
+ indexOffset, slideOffset, unevenOffset,navigables, prevNavigable;
543
557
 
544
558
  // If target is a link, prevent default action.
545
559
  $target.is('a') && event.preventDefault();
@@ -552,28 +566,56 @@
552
566
  case 'previous':
553
567
  slideOffset = indexOffset === 0 ? _.options.slidesToScroll : _.options.slidesToShow - indexOffset;
554
568
  if (_.slideCount > _.options.slidesToShow) {
555
- _.slideHandler(_.currentSlide - slideOffset);
569
+ _.slideHandler(_.currentSlide - slideOffset, false, dontAnimate);
556
570
  }
557
571
  break;
558
572
 
559
573
  case 'next':
560
574
  slideOffset = indexOffset === 0 ? _.options.slidesToScroll : indexOffset;
561
575
  if (_.slideCount > _.options.slidesToShow) {
562
- _.slideHandler(_.currentSlide + slideOffset);
576
+ _.slideHandler(_.currentSlide + slideOffset, false, dontAnimate);
563
577
  }
564
578
  break;
565
579
 
566
580
  case 'index':
567
581
  var index = event.data.index === 0 ? 0 :
568
582
  event.data.index || $(event.target).parent().index() * _.options.slidesToScroll;
569
- _.slideHandler(index);
583
+
584
+ navigables = _.getNavigableIndexes();
585
+ prevNavigable = 0;
586
+ if(navigables.indexOf(index) === -1) {
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;
594
+ }
595
+ prevNavigable = navigables[n];
596
+ }
597
+ }
598
+ }
599
+ _.slideHandler(index, false, dontAnimate);
570
600
 
571
601
  default:
572
- return false;
602
+ return;
573
603
  }
574
604
 
575
605
  };
576
606
 
607
+ Slick.prototype.clickHandler = function(event) {
608
+
609
+ var _ = this;
610
+
611
+ if(_.shouldClick === false) {
612
+ event.stopImmediatePropagation();
613
+ event.stopPropagation();
614
+ event.preventDefault();
615
+ }
616
+
617
+ }
618
+
577
619
  Slick.prototype.destroy = function() {
578
620
 
579
621
  var _ = this;
@@ -586,15 +628,28 @@
586
628
  if (_.$dots) {
587
629
  _.$dots.remove();
588
630
  }
589
- if (_.$prevArrow) {
631
+ if (_.$prevArrow && (typeof _.options.prevArrow !== 'object')) {
590
632
  _.$prevArrow.remove();
633
+ }
634
+ if (_.$nextArrow && (typeof _.options.nextArrow !== 'object')) {
591
635
  _.$nextArrow.remove();
592
636
  }
593
637
  if (_.$slides.parent().hasClass('slick-track')) {
594
638
  _.$slides.unwrap().unwrap();
595
639
  }
640
+
596
641
  _.$slides.removeClass(
597
- 'slick-slide slick-active slick-visible').css('width', '');
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
+
598
653
  _.$slider.removeClass('slick-slider');
599
654
  _.$slider.removeClass('slick-initialized');
600
655
 
@@ -693,21 +748,23 @@
693
748
 
694
749
  Slick.prototype.getDotCount = function() {
695
750
 
696
- var _ = this,
697
- breaker = 0,
698
- dotCounter = 0,
699
- dotCount = 0,
700
- dotLimit;
751
+ var _ = this;
701
752
 
702
- dotLimit = _.options.infinite === true ? _.slideCount + _.options.slidesToShow - _.options.slidesToScroll : _.slideCount;
753
+ var breakPoint = 0;
754
+ var counter = 0;
755
+ var pagerQty = 0;
703
756
 
704
- while (breaker < dotLimit) {
705
- dotCount++;
706
- dotCounter += _.options.slidesToScroll;
707
- breaker = dotCounter + _.options.slidesToShow;
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
+ }
708
765
  }
709
766
 
710
- return dotCount;
767
+ return pagerQty - 1;
711
768
 
712
769
  };
713
770
 
@@ -730,16 +787,19 @@
730
787
  }
731
788
  if (_.slideCount % _.options.slidesToScroll !== 0) {
732
789
  if (slideIndex + _.options.slidesToScroll > _.slideCount && _.slideCount > _.options.slidesToShow) {
733
- _.slideOffset = ((_.slideCount % _.options.slidesToShow) * _.slideWidth) * -1;
734
- verticalOffset = ((_.slideCount % _.options.slidesToShow) * verticalHeight) * -1;
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
+ }
735
797
  }
736
798
  }
737
799
  } else {
738
- if (_.slideCount % _.options.slidesToShow !== 0) {
739
- if (slideIndex + _.options.slidesToScroll > _.slideCount && _.slideCount > _.options.slidesToShow) {
740
- _.slideOffset = (_.options.slidesToShow * _.slideWidth) - ((_.slideCount % _.options.slidesToShow) * _.slideWidth);
741
- verticalOffset = ((_.slideCount % _.options.slidesToShow) * verticalHeight);
742
- }
800
+ if(slideIndex + _.options.slidesToShow > _.slideCount) {
801
+ _.slideOffset = ((slideIndex + _.options.slidesToShow) - _.slideCount) * _.slideWidth;
802
+ verticalOffset = ((slideIndex + _.options.slidesToShow) - _.slideCount) * verticalHeight;
743
803
  }
744
804
  }
745
805
 
@@ -751,6 +811,7 @@
751
811
  if (_.options.centerMode === true && _.options.infinite === true) {
752
812
  _.slideOffset += _.slideWidth * Math.floor(_.options.slidesToShow / 2) - _.slideWidth;
753
813
  } else if (_.options.centerMode === true) {
814
+ _.slideOffset = 0;
754
815
  _.slideOffset += _.slideWidth * Math.floor(_.options.slidesToShow / 2);
755
816
  }
756
817
 
@@ -779,10 +840,50 @@
779
840
  }
780
841
  }
781
842
 
843
+ // 1680
844
+
782
845
  return targetLeft;
783
846
 
784
847
  };
785
848
 
849
+ Slick.prototype.getNavigableIndexes = function() {
850
+
851
+ var _ = this;
852
+
853
+ var breakPoint = 0;
854
+ var counter = 0;
855
+ var indexes = [];
856
+
857
+ while (breakPoint < _.slideCount){
858
+ indexes.push(breakPoint);
859
+ breakPoint = counter + _.options.slidesToScroll;
860
+ counter += _.options.slidesToScroll <= _.options.slidesToShow ? _.options.slidesToScroll : _.options.slidesToShow;
861
+ }
862
+
863
+ return indexes;
864
+
865
+ };
866
+
867
+ Slick.prototype.getSlideCount = function() {
868
+
869
+ var _ = this, slidesTraversed;
870
+
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
+ }
884
+
885
+ };
886
+
786
887
  Slick.prototype.init = function() {
787
888
 
788
889
  var _ = this;
@@ -795,7 +896,8 @@
795
896
  _.startLoad();
796
897
  _.loadSlider();
797
898
  _.initializeEvents();
798
- _.checkResponsive();
899
+ _.updateArrows();
900
+ _.updateDots();
799
901
  }
800
902
 
801
903
  if (_.options.onInit !== null) {
@@ -831,8 +933,14 @@
831
933
 
832
934
  if (_.options.dots === true && _.options.pauseOnDotsHover === true && _.options.autoplay === true) {
833
935
  $('li', _.$dots)
834
- .on('mouseenter.slick', _.autoPlayClear)
835
- .on('mouseleave.slick', _.autoPlay);
936
+ .on('mouseenter.slick', function(){
937
+ _.paused = true;
938
+ _.autoPlayClear();
939
+ })
940
+ .on('mouseleave.slick', function(){
941
+ _.paused = false;
942
+ _.autoPlay();
943
+ });
836
944
  }
837
945
 
838
946
  };
@@ -858,9 +966,17 @@
858
966
  action: 'end'
859
967
  }, _.swipeHandler);
860
968
 
969
+ _.$list.on('click.slick', _.clickHandler);
970
+
861
971
  if (_.options.pauseOnHover === true && _.options.autoplay === true) {
862
- _.$list.on('mouseenter.slick', _.autoPlayClear);
863
- _.$list.on('mouseleave.slick', _.autoPlay);
972
+ _.$list.on('mouseenter.slick', function(){
973
+ _.paused = true;
974
+ _.autoPlayClear();
975
+ });
976
+ _.$list.on('mouseleave.slick', function(){
977
+ _.paused = false;
978
+ _.autoPlay();
979
+ });
864
980
  }
865
981
 
866
982
  if(_.options.accessibility === true) {
@@ -887,6 +1003,8 @@
887
1003
  }
888
1004
  });
889
1005
 
1006
+ $('*[draggable!=true]', _.$slideTrack).on('dragstart', function(e){ e.preventDefault(); })
1007
+
890
1008
  $(window).on('load.slick.slick-' + _.instanceUid, _.setPosition);
891
1009
  $(document).on('ready.slick.slick-' + _.instanceUid, _.setPosition);
892
1010
 
@@ -921,13 +1039,13 @@
921
1039
 
922
1040
  var _ = this;
923
1041
 
924
- if (event.keyCode === 37) {
1042
+ if (event.keyCode === 37 && _.options.accessibility === true) {
925
1043
  _.changeSlide({
926
1044
  data: {
927
1045
  message: 'previous'
928
1046
  }
929
1047
  });
930
- } else if (event.keyCode === 39) {
1048
+ } else if (event.keyCode === 39 && _.options.accessibility === true) {
931
1049
  _.changeSlide({
932
1050
  data: {
933
1051
  message: 'next'
@@ -1035,7 +1153,7 @@
1035
1153
  var _ = this,
1036
1154
  imgCount, targetImage;
1037
1155
 
1038
- imgCount = $('img[data-lazy]').length;
1156
+ imgCount = $('img[data-lazy]', _.$slider).length;
1039
1157
 
1040
1158
  if (imgCount > 0) {
1041
1159
  targetImage = $('img[data-lazy]', _.$slider).first();
@@ -1060,9 +1178,15 @@
1060
1178
 
1061
1179
  $.extend(_, _.initials);
1062
1180
 
1063
- _.currentSlide = currentSlide;
1064
1181
  _.init();
1065
1182
 
1183
+ _.changeSlide({
1184
+ data: {
1185
+ message: 'index',
1186
+ index: currentSlide,
1187
+ }
1188
+ }, true);
1189
+
1066
1190
  };
1067
1191
 
1068
1192
  Slick.prototype.reinit = function() {
@@ -1112,7 +1236,7 @@
1112
1236
 
1113
1237
  };
1114
1238
 
1115
- Slick.prototype.removeSlide = function(index, removeBefore) {
1239
+ Slick.prototype.removeSlide = function(index, removeBefore, removeAll) {
1116
1240
 
1117
1241
  var _ = this;
1118
1242
 
@@ -1129,7 +1253,11 @@
1129
1253
 
1130
1254
  _.unload();
1131
1255
 
1132
- _.$slideTrack.children(this.options.slide).eq(index).remove();
1256
+ if(removeAll === true) {
1257
+ _.$slideTrack.children().remove();
1258
+ } else {
1259
+ _.$slideTrack.children(this.options.slide).eq(index).remove();
1260
+ }
1133
1261
 
1134
1262
  _.$slides = _.$slideTrack.children(this.options.slide);
1135
1263
 
@@ -1199,11 +1327,12 @@
1199
1327
  _.$slideTrack.width(Math.ceil((_.slideWidth * _.$slideTrack.children('.slick-slide').length)));
1200
1328
 
1201
1329
  } else if (_.options.variableWidth === true) {
1202
- _.slideWidth = 0;
1330
+ var trackWidth = 0;
1331
+ _.slideWidth = Math.ceil(_.listWidth / _.options.slidesToShow);
1203
1332
  _.$slideTrack.children('.slick-slide').each(function(){
1204
- _.slideWidth += Math.ceil($(this).outerWidth(true));
1333
+ trackWidth += Math.ceil($(this).outerWidth(true));
1205
1334
  });
1206
- _.$slideTrack.width(Math.ceil(_.slideWidth) + 1);
1335
+ _.$slideTrack.width(Math.ceil(trackWidth) + 1);
1207
1336
  } else {
1208
1337
  _.slideWidth = Math.ceil(_.listWidth);
1209
1338
  _.$slideTrack.height(Math.ceil((_.$slides.first().outerHeight(true) * _.$slideTrack.children('.slick-slide').length)));
@@ -1221,13 +1350,23 @@
1221
1350
 
1222
1351
  _.$slides.each(function(index, element) {
1223
1352
  targetLeft = (_.slideWidth * index) * -1;
1224
- $(element).css({
1225
- position: 'relative',
1226
- left: targetLeft,
1227
- top: 0,
1228
- zIndex: 800,
1229
- opacity: 0
1230
- });
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
+ }
1231
1370
  });
1232
1371
 
1233
1372
  _.$slides.eq(_.currentSlide).css({
@@ -1262,6 +1401,10 @@
1262
1401
  _.setFade();
1263
1402
  }
1264
1403
 
1404
+ if (_.options.onSetPosition !== null) {
1405
+ _.options.onSetPosition.call(this, _);
1406
+ }
1407
+
1265
1408
  };
1266
1409
 
1267
1410
  Slick.prototype.setProps = function() {
@@ -1379,7 +1522,7 @@
1379
1522
  var _ = this,
1380
1523
  i, slideIndex, infiniteCount;
1381
1524
 
1382
- if (_.options.fade === true || _.options.vertical === true) {
1525
+ if (_.options.fade === true) {
1383
1526
  _.options.centerMode = false;
1384
1527
  }
1385
1528
 
@@ -1425,13 +1568,20 @@
1425
1568
  if(!index) index = 0;
1426
1569
 
1427
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);
1428
1578
  return;
1429
1579
  }
1430
1580
  _.slideHandler(index);
1431
1581
 
1432
1582
  };
1433
1583
 
1434
- Slick.prototype.slideHandler = function(index,sync) {
1584
+ Slick.prototype.slideHandler = function(index,sync,dontAnimate) {
1435
1585
 
1436
1586
  var targetSlide, animSlide, oldSlide, slideLeft, unevenOffset, targetLeft = null,
1437
1587
  _ = this;
@@ -1439,7 +1589,15 @@
1439
1589
  sync = sync || false;
1440
1590
 
1441
1591
  if (_.animating === true && _.options.waitForAnimate === true) {
1442
- return false;
1592
+ return;
1593
+ }
1594
+
1595
+ if (_.options.fade === true && _.currentSlide === index) {
1596
+ return;
1597
+ }
1598
+
1599
+ if (_.slideCount <= _.options.slidesToShow) {
1600
+ return;
1443
1601
  }
1444
1602
 
1445
1603
  if (sync === false) {
@@ -1450,26 +1608,32 @@
1450
1608
  targetLeft = _.getLeft(targetSlide);
1451
1609
  slideLeft = _.getLeft(_.currentSlide);
1452
1610
 
1453
- unevenOffset = _.slideCount % _.options.slidesToScroll !== 0 ? _.options.slidesToScroll : 0;
1454
-
1455
1611
  _.currentLeft = _.swipeLeft === null ? slideLeft : _.swipeLeft;
1456
1612
 
1457
- if (_.options.infinite === false && _.options.centerMode === false && (index < 0 || index > (_.slideCount - _.options.slidesToShow + unevenOffset))) {
1613
+ if (_.options.infinite === false && _.options.centerMode === false && (index < 0 || index > _.getDotCount() * _.options.slidesToScroll)) {
1458
1614
  if(_.options.fade === false) {
1459
1615
  targetSlide = _.currentSlide;
1460
- _.animateSlide(slideLeft, function() {
1616
+ if(dontAnimate!==true) {
1617
+ _.animateSlide(slideLeft, function() {
1618
+ _.postSlide(targetSlide);
1619
+ });
1620
+ } else {
1461
1621
  _.postSlide(targetSlide);
1462
- });
1622
+ }
1463
1623
  }
1464
- return false;
1624
+ return;
1465
1625
  } else if (_.options.infinite === false && _.options.centerMode === true && (index < 0 || index > (_.slideCount - _.options.slidesToScroll))) {
1466
1626
  if(_.options.fade === false) {
1467
1627
  targetSlide = _.currentSlide;
1468
- _.animateSlide(slideLeft, function() {
1628
+ if(dontAnimate!==true) {
1629
+ _.animateSlide(slideLeft, function() {
1630
+ _.postSlide(targetSlide);
1631
+ });
1632
+ } else {
1469
1633
  _.postSlide(targetSlide);
1470
- });
1634
+ }
1471
1635
  }
1472
- return false;
1636
+ return;
1473
1637
  }
1474
1638
 
1475
1639
  if (_.options.autoplay === true) {
@@ -1507,15 +1671,23 @@
1507
1671
  _.updateArrows();
1508
1672
 
1509
1673
  if (_.options.fade === true) {
1510
- _.fadeSlide(oldSlide,animSlide, function() {
1674
+ if(dontAnimate!==true) {
1675
+ _.fadeSlide(oldSlide,animSlide, function() {
1676
+ _.postSlide(animSlide);
1677
+ });
1678
+ } else {
1511
1679
  _.postSlide(animSlide);
1512
- });
1513
- return false;
1680
+ }
1681
+ return;
1514
1682
  }
1515
1683
 
1516
- _.animateSlide(targetLeft, function() {
1684
+ if(dontAnimate!==true) {
1685
+ _.animateSlide(targetLeft, function() {
1686
+ _.postSlide(animSlide);
1687
+ });
1688
+ } else {
1517
1689
  _.postSlide(animSlide);
1518
- });
1690
+ }
1519
1691
 
1520
1692
  };
1521
1693
 
@@ -1554,13 +1726,13 @@
1554
1726
  }
1555
1727
 
1556
1728
  if ((swipeAngle <= 45) && (swipeAngle >= 0)) {
1557
- return 'left';
1729
+ return (_.options.rtl === false ? 'left' : 'right');
1558
1730
  }
1559
1731
  if ((swipeAngle <= 360) && (swipeAngle >= 315)) {
1560
- return 'left';
1732
+ return (_.options.rtl === false ? 'left' : 'right');
1561
1733
  }
1562
1734
  if ((swipeAngle >= 135) && (swipeAngle <= 225)) {
1563
- return 'right';
1735
+ return (_.options.rtl === false ? 'right' : 'left');
1564
1736
  }
1565
1737
 
1566
1738
  return 'vertical';
@@ -1569,37 +1741,28 @@
1569
1741
 
1570
1742
  Slick.prototype.swipeEnd = function(event) {
1571
1743
 
1572
- var _ = this, slideCount, slidesTraversed, swipeDiff;
1744
+ var _ = this, slideCount;
1573
1745
 
1574
1746
  _.dragging = false;
1575
1747
 
1748
+ _.shouldClick = (_.touchObject.swipeLength > 10) ? false : true;
1749
+
1576
1750
  if (_.touchObject.curX === undefined) {
1577
1751
  return false;
1578
1752
  }
1579
1753
 
1580
1754
  if (_.touchObject.swipeLength >= _.touchObject.minSwipe) {
1581
- $(event.target).on('click.slick', function(event) {
1582
- event.stopImmediatePropagation();
1583
- event.stopPropagation();
1584
- event.preventDefault();
1585
- $(event.target).off('click.slick');
1586
- });
1587
-
1588
- if(_.options.swipeToSlide === true) {
1589
- slidesTraversed = Math.round(_.touchObject.swipeLength / _.slideWidth);
1590
- slideCount = slidesTraversed
1591
- } else {
1592
- slideCount = _.options.slidesToScroll;
1593
- }
1594
1755
 
1595
1756
  switch (_.swipeDirection()) {
1596
1757
  case 'left':
1597
- _.slideHandler(_.currentSlide + slideCount);
1758
+ _.slideHandler(_.currentSlide + _.getSlideCount());
1759
+ _.currentDirection = 0;
1598
1760
  _.touchObject = {};
1599
1761
  break;
1600
1762
 
1601
1763
  case 'right':
1602
- _.slideHandler(_.currentSlide - slideCount);
1764
+ _.slideHandler(_.currentSlide - _.getSlideCount());
1765
+ _.currentDirection = 1;
1603
1766
  _.touchObject = {};
1604
1767
  break;
1605
1768
  }
@@ -1653,12 +1816,12 @@
1653
1816
 
1654
1817
  touches = event.originalEvent !== undefined ? event.originalEvent.touches : null;
1655
1818
 
1656
- curLeft = _.getLeft(_.currentSlide);
1657
-
1658
1819
  if (!_.dragging || touches && touches.length !== 1) {
1659
1820
  return false;
1660
1821
  }
1661
1822
 
1823
+ curLeft = _.getLeft(_.currentSlide);
1824
+
1662
1825
  _.touchObject.curX = touches !== undefined ? touches[0].pageX : event.clientX;
1663
1826
  _.touchObject.curY = touches !== undefined ? touches[0].pageY : event.clientY;
1664
1827
 
@@ -1675,7 +1838,7 @@
1675
1838
  event.preventDefault();
1676
1839
  }
1677
1840
 
1678
- positionOffset = _.touchObject.curX > _.touchObject.startX ? 1 : -1;
1841
+ positionOffset = (_.options.rtl === false ? 1 : -1) * (_.touchObject.curX > _.touchObject.startX ? 1 : -1);
1679
1842
 
1680
1843
  if (_.options.vertical === false) {
1681
1844
  _.swipeLeft = curLeft + _.touchObject.swipeLength * positionOffset;
@@ -1744,8 +1907,10 @@
1744
1907
  if (_.$dots) {
1745
1908
  _.$dots.remove();
1746
1909
  }
1747
- if (_.$prevArrow) {
1910
+ if (_.$prevArrow && (typeof _.options.prevArrow !== 'object')) {
1748
1911
  _.$prevArrow.remove();
1912
+ }
1913
+ if (_.$nextArrow && (typeof _.options.nextArrow !== 'object')) {
1749
1914
  _.$nextArrow.remove();
1750
1915
  }
1751
1916
  _.$slides.removeClass(
@@ -1755,7 +1920,9 @@
1755
1920
 
1756
1921
  Slick.prototype.updateArrows = function() {
1757
1922
 
1758
- var _ = this;
1923
+ var _ = this, centerOffset;
1924
+
1925
+ centerOffset = Math.floor(_.options.slidesToShow / 2)
1759
1926
 
1760
1927
  if (_.options.arrows === true && _.options.infinite !==
1761
1928
  true && _.slideCount > _.options.slidesToShow) {
@@ -1764,7 +1931,10 @@
1764
1931
  if (_.currentSlide === 0) {
1765
1932
  _.$prevArrow.addClass('slick-disabled');
1766
1933
  _.$nextArrow.removeClass('slick-disabled');
1767
- } else if (_.currentSlide >= _.slideCount - _.options.slidesToShow) {
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) {
1768
1938
  _.$nextArrow.addClass('slick-disabled');
1769
1939
  _.$prevArrow.removeClass('slick-disabled');
1770
1940
  }
@@ -1817,7 +1987,7 @@
1817
1987
  });
1818
1988
  };
1819
1989
 
1820
- $.fn.slickGoTo = function(slide) {
1990
+ $.fn.slickGoTo = function(slide, dontAnimate) {
1821
1991
  var _ = this;
1822
1992
  return _.each(function(index, element) {
1823
1993
 
@@ -1826,7 +1996,7 @@
1826
1996
  message: 'index',
1827
1997
  index: parseInt(slide)
1828
1998
  }
1829
- });
1999
+ }, dontAnimate);
1830
2000
 
1831
2001
  });
1832
2002
  };
@@ -1886,6 +2056,15 @@
1886
2056
  });
1887
2057
  };
1888
2058
 
2059
+ $.fn.slickRemoveAll = function() {
2060
+ var _ = this;
2061
+ return _.each(function(index, element) {
2062
+
2063
+ element.slick.removeSlide(null, null, true);
2064
+
2065
+ });
2066
+ };
2067
+
1889
2068
  $.fn.slickGetOption = function(option) {
1890
2069
  var _ = this;
1891
2070
  return _.get(0).slick.options[option];
@@ -1,20 +1,22 @@
1
+ @charset "UTF-8";
1
2
  /* Slider */
2
3
  .slick-slider { position: relative; display: block; box-sizing: border-box; -moz-box-sizing: border-box; -webkit-touch-callout: none; -webkit-user-select: none; -khtml-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; -ms-touch-action: pan-y; touch-action: pan-y; -webkit-tap-highlight-color: transparent; }
3
4
 
4
5
  .slick-list { position: relative; overflow: hidden; display: block; margin: 0; padding: 0; }
5
6
  .slick-list:focus { outline: none; }
6
- .slick-loading .slick-list { background: white url("./ajax-loader.gif") center center no-repeat; }
7
+ .slick-loading .slick-list { background: #fff url("./ajax-loader.gif") center center no-repeat; }
7
8
  .slick-list.dragging { cursor: pointer; cursor: hand; }
8
9
 
9
- .slick-slider .slick-list, .slick-track, .slick-slide, .slick-slide img { -webkit-transform: translate3d(0, 0, 0); -moz-transform: translate3d(0, 0, 0); -ms-transform: translate3d(0, 0, 0); -o-transform: translate3d(0, 0, 0); transform: translate3d(0, 0, 0); }
10
+ .slick-slider .slick-track { -webkit-transform: translate3d(0, 0, 0); -moz-transform: translate3d(0, 0, 0); -ms-transform: translate3d(0, 0, 0); -o-transform: translate3d(0, 0, 0); transform: translate3d(0, 0, 0); }
10
11
 
11
- .slick-track { position: relative; left: 0; top: 0; display: block; zoom: 1; }
12
+ .slick-track { position: relative; left: 0; top: 0; display: block; }
12
13
  .slick-track:before, .slick-track:after { content: ""; display: table; }
13
14
  .slick-track:after { clear: both; }
14
15
  .slick-loading .slick-track { visibility: hidden; }
15
16
 
16
17
  .slick-slide { float: left; height: 100%; min-height: 1px; display: none; }
17
- .slick-slide img { display: block; pointer-events: none;}
18
+ [dir="rtl"] .slick-slide { float: right; }
19
+ .slick-slide img { display: block; }
18
20
  .slick-slide.slick-loading img { display: none; }
19
21
  .slick-slide.dragging img { pointer-events: none; }
20
22
  .slick-initialized .slick-slide { display: block; }
@@ -32,10 +34,14 @@
32
34
  .slick-prev:before, .slick-next:before { font-family: "slick"; font-size: 20px; line-height: 1; color: white; opacity: 0.75; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
33
35
 
34
36
  .slick-prev { left: -25px; }
35
- .slick-prev:before { content: "\2190"; }
37
+ [dir="rtl"] .slick-prev { left: auto; right: -25px; }
38
+ .slick-prev:before { content: "←"; }
39
+ [dir="rtl"] .slick-prev:before { content: "→"; }
36
40
 
37
41
  .slick-next { right: -25px; }
38
- .slick-next:before { content: "\2192"; }
42
+ [dir="rtl"] .slick-next { left: -25px; right: auto; }
43
+ .slick-next:before { content: "→"; }
44
+ [dir="rtl"] .slick-next:before { content: "←"; }
39
45
 
40
46
  /* Dots */
41
47
  .slick-slider { margin-bottom: 30px; }
@@ -45,11 +51,7 @@
45
51
  .slick-dots li button { border: 0; background: transparent; display: block; height: 20px; width: 20px; outline: none; line-height: 0; font-size: 0; color: transparent; padding: 5px; cursor: pointer; }
46
52
  .slick-dots li button:hover, .slick-dots li button:focus { outline: none; }
47
53
  .slick-dots li button:hover:before, .slick-dots li button:focus:before { opacity: 1; }
48
- .slick-dots li button:before { position: absolute; top: 0; left: 0; content: "\2022"; width: 20px; height: 20px; font-family: "slick"; font-size: 6px; line-height: 20px; text-align: center; color: black; opacity: 0.25; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
54
+ .slick-dots li button:before { position: absolute; top: 0; left: 0; content: ""; width: 20px; height: 20px; font-family: "slick"; font-size: 6px; line-height: 20px; text-align: center; color: black; opacity: 0.25; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
49
55
  .slick-dots li.slick-active button:before { color: black; opacity: 0.75; }
50
56
 
51
- [dir="rtl"] .slick-next {right: auto;left: -25px;}
52
- [dir="rtl"] .slick-next:before {content: "\2190";}
53
- [dir="rtl"] .slick-prev {right: -25px;left: auto;}
54
- [dir="rtl"] .slick-prev:before {content: "\2192";}
55
- [dir="rtl"] .slick-slide {float: right;}
57
+ /*# sourceMappingURL=slick.css.map */
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jquery-slick-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.11
4
+ version: 1.3.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ilya Bodrov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-10-24 00:00:00.000000000 Z
11
+ date: 2014-11-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties
@@ -63,7 +63,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
63
63
  version: '0'
64
64
  requirements: []
65
65
  rubyforge_project:
66
- rubygems_version: 2.4.2
66
+ rubygems_version: 2.4.3
67
67
  signing_key:
68
68
  specification_version: 4
69
69
  summary: Integrates Slick carousel into Rails app.