slick_rails 1.4.1.1 → 1.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/javascripts/slick.js +374 -218
- data/lib/slick_rails/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 42f17d1e85dbf014a16b0b481aa80917abb2652d
|
4
|
+
data.tar.gz: 5bbf14fe6b0a1a51f81b29490c3854be54764064
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 144c55d6116bb6e86d3517315fe287d8f6f693143782fbae75194186217441e4b366974b305a81e7c777d71d723d93b875973e2ac0e2a4d657a26a8dc6fd9860
|
7
|
+
data.tar.gz: 871a5d7503d0c0376a051b899c2e226451dd72ff34b73d0357635437484ebe632f1264b25c644e764abe48be0093dde5c43cd6fe9f2645e88ac4fa40ba86c811
|
@@ -6,7 +6,7 @@
|
|
6
6
|
|___/_|_|\___|_|\_(_)/ |___/
|
7
7
|
|__/
|
8
8
|
|
9
|
-
Version: 1.
|
9
|
+
Version: 1.5.0
|
10
10
|
Author: Ken Wheeler
|
11
11
|
Website: http://kenwheeler.github.io
|
12
12
|
Docs: http://kenwheeler.github.io/slick
|
@@ -14,9 +14,7 @@
|
|
14
14
|
Issues: http://github.com/kenwheeler/slick/issues
|
15
15
|
|
16
16
|
*/
|
17
|
-
|
18
17
|
/* global window, document, define, jQuery, setInterval, clearInterval */
|
19
|
-
|
20
18
|
(function(factory) {
|
21
19
|
'use strict';
|
22
20
|
if (typeof define === 'function' && define.amd) {
|
@@ -72,8 +70,10 @@
|
|
72
70
|
pauseOnDotsHover: false,
|
73
71
|
respondTo: 'window',
|
74
72
|
responsive: null,
|
73
|
+
rows: 1,
|
75
74
|
rtl: false,
|
76
75
|
slide: '',
|
76
|
+
slidesPerRow: 1,
|
77
77
|
slidesToShow: 1,
|
78
78
|
slidesToScroll: 1,
|
79
79
|
speed: 500,
|
@@ -84,6 +84,7 @@
|
|
84
84
|
useCSS: true,
|
85
85
|
variableWidth: false,
|
86
86
|
vertical: false,
|
87
|
+
verticalSwiping: false,
|
87
88
|
waitForAnimate: true
|
88
89
|
};
|
89
90
|
|
@@ -121,16 +122,17 @@
|
|
121
122
|
_.breakpoints = [];
|
122
123
|
_.breakpointSettings = [];
|
123
124
|
_.cssTransitions = false;
|
124
|
-
_.hidden =
|
125
|
+
_.hidden = 'hidden';
|
125
126
|
_.paused = false;
|
126
127
|
_.positionProp = null;
|
127
128
|
_.respondTo = null;
|
129
|
+
_.rowCount = 1;
|
128
130
|
_.shouldClick = true;
|
129
131
|
_.$slider = $(element);
|
130
132
|
_.$slidesCache = null;
|
131
133
|
_.transformType = null;
|
132
134
|
_.transitionType = null;
|
133
|
-
_.visibilityChange =
|
135
|
+
_.visibilityChange = 'visibilitychange';
|
134
136
|
_.windowWidth = 0;
|
135
137
|
_.windowTimer = null;
|
136
138
|
|
@@ -144,18 +146,18 @@
|
|
144
146
|
responsiveSettings = _.options.responsive || null;
|
145
147
|
|
146
148
|
if (responsiveSettings && responsiveSettings.length > -1) {
|
147
|
-
_.respondTo = _.options.respondTo ||
|
149
|
+
_.respondTo = _.options.respondTo || 'window';
|
148
150
|
for (breakpoint in responsiveSettings) {
|
149
151
|
if (responsiveSettings.hasOwnProperty(breakpoint)) {
|
150
152
|
_.breakpoints.push(responsiveSettings[
|
151
153
|
breakpoint].breakpoint);
|
152
154
|
_.breakpointSettings[responsiveSettings[
|
153
|
-
|
155
|
+
breakpoint].breakpoint] =
|
154
156
|
responsiveSettings[breakpoint].settings;
|
155
157
|
}
|
156
158
|
}
|
157
159
|
_.breakpoints.sort(function(a, b) {
|
158
|
-
if(_.options.mobileFirst === true) {
|
160
|
+
if (_.options.mobileFirst === true) {
|
159
161
|
return a - b;
|
160
162
|
} else {
|
161
163
|
return b - a;
|
@@ -163,15 +165,15 @@
|
|
163
165
|
});
|
164
166
|
}
|
165
167
|
|
166
|
-
if (typeof document.mozHidden !==
|
167
|
-
_.hidden =
|
168
|
-
_.visibilityChange =
|
169
|
-
} else if (typeof document.msHidden !==
|
170
|
-
_.hidden =
|
171
|
-
_.visibilityChange =
|
172
|
-
} else if (typeof document.webkitHidden !==
|
173
|
-
_.hidden =
|
174
|
-
_.visibilityChange =
|
168
|
+
if (typeof document.mozHidden !== 'undefined') {
|
169
|
+
_.hidden = 'mozHidden';
|
170
|
+
_.visibilityChange = 'mozvisibilitychange';
|
171
|
+
} else if (typeof document.msHidden !== 'undefined') {
|
172
|
+
_.hidden = 'msHidden';
|
173
|
+
_.visibilityChange = 'msvisibilitychange';
|
174
|
+
} else if (typeof document.webkitHidden !== 'undefined') {
|
175
|
+
_.hidden = 'webkitHidden';
|
176
|
+
_.visibilityChange = 'webkitvisibilitychange';
|
175
177
|
}
|
176
178
|
|
177
179
|
_.autoPlay = $.proxy(_.autoPlay, _);
|
@@ -238,7 +240,7 @@
|
|
238
240
|
_.$slideTrack.append(_.$slides);
|
239
241
|
|
240
242
|
_.$slides.each(function(index, element) {
|
241
|
-
$(element).attr(
|
243
|
+
$(element).attr('data-slick-index', index);
|
242
244
|
});
|
243
245
|
|
244
246
|
_.$slidesCache = _.$slides;
|
@@ -247,17 +249,20 @@
|
|
247
249
|
|
248
250
|
};
|
249
251
|
|
250
|
-
Slick.prototype.animateHeight = function(){
|
252
|
+
Slick.prototype.animateHeight = function() {
|
251
253
|
var _ = this;
|
252
|
-
if(_.options.slidesToShow === 1 && _.options.adaptiveHeight === true && _.options.vertical === false) {
|
254
|
+
if (_.options.slidesToShow === 1 && _.options.adaptiveHeight === true && _.options.vertical === false) {
|
253
255
|
var targetHeight = _.$slides.eq(_.currentSlide).outerHeight(true);
|
254
|
-
_.$list.animate({
|
256
|
+
_.$list.animate({
|
257
|
+
height: targetHeight
|
258
|
+
}, _.options.speed);
|
255
259
|
}
|
256
260
|
};
|
257
261
|
|
258
262
|
Slick.prototype.animateSlide = function(targetLeft, callback) {
|
259
263
|
|
260
|
-
var animProps = {},
|
264
|
+
var animProps = {},
|
265
|
+
_ = this;
|
261
266
|
|
262
267
|
_.animateHeight();
|
263
268
|
|
@@ -335,8 +340,9 @@
|
|
335
340
|
};
|
336
341
|
|
337
342
|
Slick.prototype.asNavFor = function(index) {
|
338
|
-
var _ = this,
|
339
|
-
|
343
|
+
var _ = this,
|
344
|
+
asNavFor = _.options.asNavFor !== null ? $(_.options.asNavFor).slick('getSlick') : null;
|
345
|
+
if (asNavFor !== null) asNavFor.slideHandler(index, true);
|
340
346
|
};
|
341
347
|
|
342
348
|
Slick.prototype.applyTransition = function(slide) {
|
@@ -460,7 +466,7 @@
|
|
460
466
|
_.$dots = $(dotString).appendTo(
|
461
467
|
_.options.appendDots);
|
462
468
|
|
463
|
-
_.$dots.find('li').first().addClass('slick-active').attr(
|
469
|
+
_.$dots.find('li').first().addClass('slick-active').attr('aria-hidden', 'false');
|
464
470
|
|
465
471
|
}
|
466
472
|
|
@@ -470,13 +476,13 @@
|
|
470
476
|
|
471
477
|
var _ = this;
|
472
478
|
|
473
|
-
_.$slides = _.$slider.children(
|
479
|
+
_.$slides = _.$slider.children(
|
474
480
|
':not(.slick-cloned)').addClass(
|
475
481
|
'slick-slide');
|
476
482
|
_.slideCount = _.$slides.length;
|
477
483
|
|
478
484
|
_.$slides.each(function(index, element) {
|
479
|
-
$(element).attr(
|
485
|
+
$(element).attr('data-slick-index', index);
|
480
486
|
});
|
481
487
|
|
482
488
|
_.$slidesCache = _.$slides;
|
@@ -517,18 +523,53 @@
|
|
517
523
|
|
518
524
|
};
|
519
525
|
|
526
|
+
Slick.prototype.buildRows = function() {
|
527
|
+
|
528
|
+
var _ = this, a, b, c, newSlides, numOfSlides, originalSlides,slidesPerSection;
|
529
|
+
|
530
|
+
newSlides = document.createDocumentFragment();
|
531
|
+
originalSlides = _.$slider.children();
|
532
|
+
|
533
|
+
if(_.options.rows > 1) {
|
534
|
+
slidesPerSection = _.options.slidesPerRow * _.options.rows;
|
535
|
+
numOfSlides = Math.ceil(
|
536
|
+
originalSlides.length / slidesPerSection
|
537
|
+
);
|
538
|
+
|
539
|
+
for(a = 0; a < numOfSlides; a++){
|
540
|
+
var slide = document.createElement('div');
|
541
|
+
for(b = 0; b < _.options.rows; b++) {
|
542
|
+
var row = document.createElement('div');
|
543
|
+
for(c = 0; c < _.options.slidesPerRow; c++) {
|
544
|
+
var target = (a * slidesPerSection + ((b * _.options.slidesPerRow) + c));
|
545
|
+
if (originalSlides.get(target)) {
|
546
|
+
row.appendChild(originalSlides.get(target));
|
547
|
+
}
|
548
|
+
}
|
549
|
+
slide.appendChild(row);
|
550
|
+
}
|
551
|
+
newSlides.appendChild(slide);
|
552
|
+
};
|
553
|
+
_.$slider.html(newSlides);
|
554
|
+
_.$slider.children().children().children()
|
555
|
+
.width((100 / _.options.slidesPerRow) + "%")
|
556
|
+
.css({'display': 'inline-block'});
|
557
|
+
};
|
558
|
+
|
559
|
+
};
|
560
|
+
|
520
561
|
Slick.prototype.checkResponsive = function(initial) {
|
521
562
|
|
522
563
|
var _ = this,
|
523
564
|
breakpoint, targetBreakpoint, respondToWidth;
|
524
565
|
var sliderWidth = _.$slider.width();
|
525
566
|
var windowWidth = window.innerWidth || $(window).width();
|
526
|
-
if (_.respondTo ===
|
527
|
-
|
528
|
-
} else if (_.respondTo ===
|
529
|
-
|
530
|
-
} else if (_.respondTo ===
|
531
|
-
|
567
|
+
if (_.respondTo === 'window') {
|
568
|
+
respondToWidth = windowWidth;
|
569
|
+
} else if (_.respondTo === 'slider') {
|
570
|
+
respondToWidth = sliderWidth;
|
571
|
+
} else if (_.respondTo === 'min') {
|
572
|
+
respondToWidth = Math.min(windowWidth, sliderWidth);
|
532
573
|
}
|
533
574
|
|
534
575
|
if (_.originalSettings.responsive && _.originalSettings
|
@@ -555,26 +596,26 @@
|
|
555
596
|
if (targetBreakpoint !== _.activeBreakpoint) {
|
556
597
|
_.activeBreakpoint =
|
557
598
|
targetBreakpoint;
|
558
|
-
if(_.breakpointSettings[targetBreakpoint] ===
|
599
|
+
if (_.breakpointSettings[targetBreakpoint] === 'unslick') {
|
559
600
|
_.unslick();
|
560
601
|
} else {
|
561
602
|
_.options = $.extend({}, _.originalSettings,
|
562
603
|
_.breakpointSettings[
|
563
604
|
targetBreakpoint]);
|
564
|
-
if(initial === true)
|
605
|
+
if (initial === true)
|
565
606
|
_.currentSlide = _.options.initialSlide;
|
566
607
|
_.refresh();
|
567
608
|
}
|
568
609
|
}
|
569
610
|
} else {
|
570
611
|
_.activeBreakpoint = targetBreakpoint;
|
571
|
-
if(_.breakpointSettings[targetBreakpoint] ===
|
612
|
+
if (_.breakpointSettings[targetBreakpoint] === 'unslick') {
|
572
613
|
_.unslick();
|
573
614
|
} else {
|
574
615
|
_.options = $.extend({}, _.originalSettings,
|
575
616
|
_.breakpointSettings[
|
576
617
|
targetBreakpoint]);
|
577
|
-
if(initial === true)
|
618
|
+
if (initial === true)
|
578
619
|
_.currentSlide = _.options.initialSlide;
|
579
620
|
_.refresh();
|
580
621
|
}
|
@@ -583,7 +624,7 @@
|
|
583
624
|
if (_.activeBreakpoint !== null) {
|
584
625
|
_.activeBreakpoint = null;
|
585
626
|
_.options = _.originalSettings;
|
586
|
-
if(initial === true)
|
627
|
+
if (initial === true)
|
587
628
|
_.currentSlide = _.options.initialSlide;
|
588
629
|
_.refresh();
|
589
630
|
}
|
@@ -610,7 +651,7 @@
|
|
610
651
|
case 'previous':
|
611
652
|
slideOffset = indexOffset === 0 ? _.options.slidesToScroll : _.options.slidesToShow - indexOffset;
|
612
653
|
if (_.slideCount > _.options.slidesToShow) {
|
613
|
-
_.slideHandler(_.currentSlide
|
654
|
+
_.slideHandler(_.currentSlide - slideOffset, false, dontAnimate);
|
614
655
|
}
|
615
656
|
break;
|
616
657
|
|
@@ -636,15 +677,16 @@
|
|
636
677
|
|
637
678
|
Slick.prototype.checkNavigable = function(index) {
|
638
679
|
|
639
|
-
var _ = this,
|
680
|
+
var _ = this,
|
681
|
+
navigables, prevNavigable;
|
640
682
|
|
641
683
|
navigables = _.getNavigableIndexes();
|
642
684
|
prevNavigable = 0;
|
643
|
-
if(index > navigables[navigables.length -1]){
|
644
|
-
index = navigables[navigables.length -1];
|
685
|
+
if (index > navigables[navigables.length - 1]) {
|
686
|
+
index = navigables[navigables.length - 1];
|
645
687
|
} else {
|
646
|
-
for(var n in navigables) {
|
647
|
-
if(index < navigables[n]) {
|
688
|
+
for (var n in navigables) {
|
689
|
+
if (index < navigables[n]) {
|
648
690
|
index = prevNavigable;
|
649
691
|
break;
|
650
692
|
}
|
@@ -655,11 +697,74 @@
|
|
655
697
|
return index;
|
656
698
|
};
|
657
699
|
|
700
|
+
Slick.prototype.cleanUpEvents = function() {
|
701
|
+
|
702
|
+
var _ = this;
|
703
|
+
|
704
|
+
if (_.options.dots === true && _.slideCount > _.options.slidesToShow) {
|
705
|
+
$('li', _.$dots).off('click.slick', _.changeSlide);
|
706
|
+
}
|
707
|
+
|
708
|
+
if (_.options.dots === true && _.options.pauseOnDotsHover === true && _.options.autoplay === true) {
|
709
|
+
$('li', _.$dots)
|
710
|
+
.off('mouseenter.slick', _.setPaused.bind(_, true))
|
711
|
+
.off('mouseleave.slick', _.setPaused.bind(_, false));
|
712
|
+
}
|
713
|
+
|
714
|
+
if (_.options.arrows === true && _.slideCount > _.options.slidesToShow) {
|
715
|
+
_.$prevArrow && _.$prevArrow.off('click.slick', _.changeSlide);
|
716
|
+
_.$nextArrow && _.$nextArrow.off('click.slick', _.changeSlide);
|
717
|
+
}
|
718
|
+
|
719
|
+
_.$list.off('touchstart.slick mousedown.slick', _.swipeHandler);
|
720
|
+
_.$list.off('touchmove.slick mousemove.slick', _.swipeHandler);
|
721
|
+
_.$list.off('touchend.slick mouseup.slick', _.swipeHandler);
|
722
|
+
_.$list.off('touchcancel.slick mouseleave.slick', _.swipeHandler);
|
723
|
+
|
724
|
+
_.$list.off('click.slick', _.clickHandler);
|
725
|
+
|
726
|
+
if (_.options.autoplay === true) {
|
727
|
+
$(document).off(_.visibilityChange, _.visibility);
|
728
|
+
}
|
729
|
+
|
730
|
+
_.$list.off('mouseenter.slick', _.setPaused.bind(_, true));
|
731
|
+
_.$list.off('mouseleave.slick', _.setPaused.bind(_, false));
|
732
|
+
|
733
|
+
if (_.options.accessibility === true) {
|
734
|
+
_.$list.off('keydown.slick', _.keyHandler);
|
735
|
+
}
|
736
|
+
|
737
|
+
if (_.options.focusOnSelect === true) {
|
738
|
+
$(_.$slideTrack).children().off('click.slick', _.selectHandler);
|
739
|
+
}
|
740
|
+
|
741
|
+
$(window).off('orientationchange.slick.slick-' + _.instanceUid, _.orientationChange);
|
742
|
+
|
743
|
+
$(window).off('resize.slick.slick-' + _.instanceUid, _.resize);
|
744
|
+
|
745
|
+
$('[draggable!=true]', _.$slideTrack).off('dragstart', _.preventDefault);
|
746
|
+
|
747
|
+
$(window).off('load.slick.slick-' + _.instanceUid, _.setPosition);
|
748
|
+
$(document).off('ready.slick.slick-' + _.instanceUid, _.setPosition);
|
749
|
+
};
|
750
|
+
|
751
|
+
Slick.prototype.cleanUpRows = function() {
|
752
|
+
|
753
|
+
var _ = this, originalSlides;
|
754
|
+
|
755
|
+
if(_.options.rows > 1) {
|
756
|
+
originalSlides = _.$slides.children().children();
|
757
|
+
originalSlides.removeAttr('style');
|
758
|
+
_.$slider.html(originalSlides);
|
759
|
+
}
|
760
|
+
|
761
|
+
};
|
762
|
+
|
658
763
|
Slick.prototype.clickHandler = function(event) {
|
659
764
|
|
660
765
|
var _ = this;
|
661
766
|
|
662
|
-
if(_.shouldClick === false) {
|
767
|
+
if (_.shouldClick === false) {
|
663
768
|
event.stopImmediatePropagation();
|
664
769
|
event.stopPropagation();
|
665
770
|
event.preventDefault();
|
@@ -675,7 +780,10 @@
|
|
675
780
|
|
676
781
|
_.touchObject = {};
|
677
782
|
|
783
|
+
_.cleanUpEvents();
|
784
|
+
|
678
785
|
$('.slick-cloned', _.$slider).remove();
|
786
|
+
|
679
787
|
if (_.$dots) {
|
680
788
|
_.$dots.remove();
|
681
789
|
}
|
@@ -686,28 +794,27 @@
|
|
686
794
|
_.$nextArrow.remove();
|
687
795
|
}
|
688
796
|
|
797
|
+
if (_.$slides) {
|
798
|
+
_.$slides.removeClass('slick-slide slick-active slick-center slick-visible')
|
799
|
+
.attr('aria-hidden', 'true')
|
800
|
+
.removeAttr('data-slick-index')
|
801
|
+
.css({
|
802
|
+
position: '',
|
803
|
+
left: '',
|
804
|
+
top: '',
|
805
|
+
zIndex: '',
|
806
|
+
opacity: '',
|
807
|
+
width: ''
|
808
|
+
});
|
689
809
|
|
690
|
-
|
691
|
-
|
692
|
-
|
693
|
-
|
694
|
-
position: '',
|
695
|
-
left: '',
|
696
|
-
top: '',
|
697
|
-
zIndex: '',
|
698
|
-
opacity: '',
|
699
|
-
width: ''
|
700
|
-
});
|
810
|
+
_.$slider.html(_.$slides);
|
811
|
+
}
|
812
|
+
|
813
|
+
_.cleanUpRows();
|
701
814
|
|
702
815
|
_.$slider.removeClass('slick-slider');
|
703
816
|
_.$slider.removeClass('slick-initialized');
|
704
817
|
|
705
|
-
_.$list.off('.slick');
|
706
|
-
$(window).off('.slick-' + _.instanceUid);
|
707
|
-
$(document).off('.slick-' + _.instanceUid);
|
708
|
-
|
709
|
-
_.$slider.html(_.$slides);
|
710
|
-
|
711
818
|
};
|
712
819
|
|
713
820
|
Slick.prototype.disableTransition = function(slide) {
|
@@ -715,7 +822,7 @@
|
|
715
822
|
var _ = this,
|
716
823
|
transition = {};
|
717
824
|
|
718
|
-
transition[_.transitionType] =
|
825
|
+
transition[_.transitionType] = '';
|
719
826
|
|
720
827
|
if (_.options.fade === false) {
|
721
828
|
_.$slideTrack.css(transition);
|
@@ -794,15 +901,15 @@
|
|
794
901
|
var counter = 0;
|
795
902
|
var pagerQty = 0;
|
796
903
|
|
797
|
-
if(_.options.infinite === true) {
|
904
|
+
if (_.options.infinite === true) {
|
798
905
|
pagerQty = Math.ceil(_.slideCount / _.options.slidesToScroll);
|
799
906
|
} else if (_.options.centerMode === true) {
|
800
907
|
pagerQty = _.slideCount;
|
801
908
|
} else {
|
802
|
-
while (breakPoint < _.slideCount){
|
909
|
+
while (breakPoint < _.slideCount) {
|
803
910
|
++pagerQty;
|
804
911
|
breakPoint = counter + _.options.slidesToShow;
|
805
|
-
counter += _.options.slidesToScroll <= _.options.slidesToShow ? _.options.slidesToScroll
|
912
|
+
counter += _.options.slidesToScroll <= _.options.slidesToShow ? _.options.slidesToScroll : _.options.slidesToShow;
|
806
913
|
}
|
807
914
|
}
|
808
915
|
|
@@ -828,7 +935,7 @@
|
|
828
935
|
}
|
829
936
|
if (_.slideCount % _.options.slidesToScroll !== 0) {
|
830
937
|
if (slideIndex + _.options.slidesToScroll > _.slideCount && _.slideCount > _.options.slidesToShow) {
|
831
|
-
if(slideIndex > _.slideCount) {
|
938
|
+
if (slideIndex > _.slideCount) {
|
832
939
|
_.slideOffset = ((_.options.slidesToShow - (slideIndex - _.slideCount)) * _.slideWidth) * -1;
|
833
940
|
verticalOffset = ((_.options.slidesToShow - (slideIndex - _.slideCount)) * verticalHeight) * -1;
|
834
941
|
} else {
|
@@ -838,13 +945,13 @@
|
|
838
945
|
}
|
839
946
|
}
|
840
947
|
} else {
|
841
|
-
if(slideIndex + _.options.slidesToShow > _.slideCount) {
|
948
|
+
if (slideIndex + _.options.slidesToShow > _.slideCount) {
|
842
949
|
_.slideOffset = ((slideIndex + _.options.slidesToShow) - _.slideCount) * _.slideWidth;
|
843
950
|
verticalOffset = ((slideIndex + _.options.slidesToShow) - _.slideCount) * verticalHeight;
|
844
951
|
}
|
845
952
|
}
|
846
953
|
|
847
|
-
if (_.slideCount <= _.options.slidesToShow){
|
954
|
+
if (_.slideCount <= _.options.slidesToShow) {
|
848
955
|
_.slideOffset = 0;
|
849
956
|
verticalOffset = 0;
|
850
957
|
}
|
@@ -873,7 +980,7 @@
|
|
873
980
|
targetLeft = targetSlide[0] ? targetSlide[0].offsetLeft * -1 : 0;
|
874
981
|
|
875
982
|
if (_.options.centerMode === true) {
|
876
|
-
if(_.options.infinite === false) {
|
983
|
+
if (_.options.infinite === false) {
|
877
984
|
targetSlide = _.$slideTrack.children('.slick-slide').eq(slideIndex);
|
878
985
|
} else {
|
879
986
|
targetSlide = _.$slideTrack.children('.slick-slide').eq(slideIndex + _.options.slidesToShow + 1);
|
@@ -897,21 +1004,25 @@
|
|
897
1004
|
|
898
1005
|
Slick.prototype.getNavigableIndexes = function() {
|
899
1006
|
|
900
|
-
var _ = this,
|
1007
|
+
var _ = this,
|
1008
|
+
breakPoint = 0,
|
1009
|
+
counter = 0,
|
1010
|
+
indexes = [],
|
1011
|
+
max;
|
901
1012
|
|
902
|
-
if(_.options.infinite === false) {
|
1013
|
+
if (_.options.infinite === false) {
|
903
1014
|
max = _.slideCount - _.options.slidesToShow + 1;
|
904
1015
|
if (_.options.centerMode === true) max = _.slideCount;
|
905
1016
|
} else {
|
906
|
-
breakPoint = _.
|
907
|
-
counter = _.
|
1017
|
+
breakPoint = _.options.slidesToScroll * -1;
|
1018
|
+
counter = _.options.slidesToScroll * -1;
|
908
1019
|
max = _.slideCount * 2;
|
909
1020
|
}
|
910
1021
|
|
911
|
-
while (breakPoint < max){
|
1022
|
+
while (breakPoint < max) {
|
912
1023
|
indexes.push(breakPoint);
|
913
1024
|
breakPoint = counter + _.options.slidesToScroll;
|
914
|
-
counter += _.options.slidesToScroll <= _.options.slidesToShow ? _.options.slidesToScroll
|
1025
|
+
counter += _.options.slidesToScroll <= _.options.slidesToShow ? _.options.slidesToScroll : _.options.slidesToShow;
|
915
1026
|
}
|
916
1027
|
|
917
1028
|
return indexes;
|
@@ -926,12 +1037,13 @@
|
|
926
1037
|
|
927
1038
|
Slick.prototype.getSlideCount = function() {
|
928
1039
|
|
929
|
-
var _ = this,
|
1040
|
+
var _ = this,
|
1041
|
+
slidesTraversed, swipedSlide, centerOffset;
|
930
1042
|
|
931
1043
|
centerOffset = _.options.centerMode === true ? _.slideWidth * Math.floor(_.options.slidesToShow / 2) : 0;
|
932
1044
|
|
933
|
-
if(_.options.swipeToSlide === true) {
|
934
|
-
_.$slideTrack.find('.slick-slide').each(function(index, slide){
|
1045
|
+
if (_.options.swipeToSlide === true) {
|
1046
|
+
_.$slideTrack.find('.slick-slide').each(function(index, slide) {
|
935
1047
|
if (slide.offsetLeft - centerOffset + ($(slide).outerWidth() / 2) > (_.swipeLeft * -1)) {
|
936
1048
|
swipedSlide = slide;
|
937
1049
|
return false;
|
@@ -968,6 +1080,7 @@
|
|
968
1080
|
if (!$(_.$slider).hasClass('slick-initialized')) {
|
969
1081
|
|
970
1082
|
$(_.$slider).addClass('slick-initialized');
|
1083
|
+
_.buildRows();
|
971
1084
|
_.buildOut();
|
972
1085
|
_.setProps();
|
973
1086
|
_.startLoad();
|
@@ -977,7 +1090,7 @@
|
|
977
1090
|
_.updateDots();
|
978
1091
|
}
|
979
1092
|
|
980
|
-
_.$slider.trigger(
|
1093
|
+
_.$slider.trigger('init', [_]);
|
981
1094
|
|
982
1095
|
};
|
983
1096
|
|
@@ -1008,14 +1121,8 @@
|
|
1008
1121
|
|
1009
1122
|
if (_.options.dots === true && _.options.pauseOnDotsHover === true && _.options.autoplay === true) {
|
1010
1123
|
$('li', _.$dots)
|
1011
|
-
.on('mouseenter.slick',
|
1012
|
-
|
1013
|
-
_.autoPlayClear();
|
1014
|
-
})
|
1015
|
-
.on('mouseleave.slick', function(){
|
1016
|
-
_.paused = false;
|
1017
|
-
_.autoPlay();
|
1018
|
-
});
|
1124
|
+
.on('mouseenter.slick', _.setPaused.bind(_, true))
|
1125
|
+
.on('mouseleave.slick', _.setPaused.bind(_, false));
|
1019
1126
|
}
|
1020
1127
|
|
1021
1128
|
};
|
@@ -1044,51 +1151,25 @@
|
|
1044
1151
|
_.$list.on('click.slick', _.clickHandler);
|
1045
1152
|
|
1046
1153
|
if (_.options.autoplay === true) {
|
1047
|
-
|
1048
|
-
$(document).on(_.visibilityChange, function(){
|
1049
|
-
_.visibility();
|
1050
|
-
});
|
1051
|
-
|
1052
|
-
if( _.options.pauseOnHover === true ) {
|
1053
|
-
|
1054
|
-
_.$list.on('mouseenter.slick', function(){
|
1055
|
-
_.paused = true;
|
1056
|
-
_.autoPlayClear();
|
1057
|
-
});
|
1058
|
-
_.$list.on('mouseleave.slick', function(){
|
1059
|
-
_.paused = false;
|
1060
|
-
_.autoPlay();
|
1061
|
-
});
|
1062
|
-
|
1063
|
-
}
|
1064
|
-
|
1154
|
+
$(document).on(_.visibilityChange, _.visibility.bind(_));
|
1065
1155
|
}
|
1066
1156
|
|
1067
|
-
|
1157
|
+
_.$list.on('mouseenter.slick', _.setPaused.bind(_, true));
|
1158
|
+
_.$list.on('mouseleave.slick', _.setPaused.bind(_, false));
|
1159
|
+
|
1160
|
+
if (_.options.accessibility === true) {
|
1068
1161
|
_.$list.on('keydown.slick', _.keyHandler);
|
1069
1162
|
}
|
1070
1163
|
|
1071
|
-
if(_.options.focusOnSelect === true) {
|
1164
|
+
if (_.options.focusOnSelect === true) {
|
1072
1165
|
$(_.$slideTrack).children().on('click.slick', _.selectHandler);
|
1073
1166
|
}
|
1074
1167
|
|
1075
|
-
$(window).on('orientationchange.slick.slick-' + _.instanceUid,
|
1076
|
-
_.checkResponsive();
|
1077
|
-
_.setPosition();
|
1078
|
-
});
|
1168
|
+
$(window).on('orientationchange.slick.slick-' + _.instanceUid, _.orientationChange.bind(_));
|
1079
1169
|
|
1080
|
-
$(window).on('resize.slick.slick-' + _.instanceUid,
|
1081
|
-
if ($(window).width() !== _.windowWidth) {
|
1082
|
-
clearTimeout(_.windowDelay);
|
1083
|
-
_.windowDelay = window.setTimeout(function() {
|
1084
|
-
_.windowWidth = $(window).width();
|
1085
|
-
_.checkResponsive();
|
1086
|
-
_.setPosition();
|
1087
|
-
}, 50);
|
1088
|
-
}
|
1089
|
-
});
|
1170
|
+
$(window).on('resize.slick.slick-' + _.instanceUid, _.resize.bind(_));
|
1090
1171
|
|
1091
|
-
$('
|
1172
|
+
$('[draggable!=true]', _.$slideTrack).on('dragstart', _.preventDefault);
|
1092
1173
|
|
1093
1174
|
$(window).on('load.slick.slick-' + _.instanceUid, _.setPosition);
|
1094
1175
|
$(document).on('ready.slick.slick-' + _.instanceUid, _.setPosition);
|
@@ -1148,41 +1229,50 @@
|
|
1148
1229
|
function loadImages(imagesScope) {
|
1149
1230
|
$('img[data-lazy]', imagesScope).each(function() {
|
1150
1231
|
var image = $(this),
|
1151
|
-
imageSource = $(this).attr('data-lazy')
|
1232
|
+
imageSource = $(this).attr('data-lazy'),
|
1233
|
+
imageToLoad = document.createElement('img');
|
1234
|
+
|
1235
|
+
imageToLoad.onload = function() {
|
1236
|
+
image.animate({
|
1237
|
+
opacity: 1
|
1238
|
+
}, 200);
|
1239
|
+
};
|
1240
|
+
imageToLoad.src = imageSource;
|
1152
1241
|
|
1153
1242
|
image
|
1154
|
-
|
1155
|
-
|
1156
|
-
|
1157
|
-
|
1158
|
-
|
1243
|
+
.css({
|
1244
|
+
opacity: 0
|
1245
|
+
})
|
1246
|
+
.attr('src', imageSource)
|
1247
|
+
.removeAttr('data-lazy')
|
1248
|
+
.removeClass('slick-loading');
|
1159
1249
|
});
|
1160
1250
|
}
|
1161
1251
|
|
1162
1252
|
if (_.options.centerMode === true) {
|
1163
1253
|
if (_.options.infinite === true) {
|
1164
|
-
rangeStart = _.currentSlide + (_.options.slidesToShow/2 + 1);
|
1254
|
+
rangeStart = _.currentSlide + (_.options.slidesToShow / 2 + 1);
|
1165
1255
|
rangeEnd = rangeStart + _.options.slidesToShow + 2;
|
1166
1256
|
} else {
|
1167
|
-
rangeStart = Math.max(0, _.currentSlide - (_.options.slidesToShow/2 + 1));
|
1168
|
-
rangeEnd = 2 + (_.options.slidesToShow/2 + 1) + _.currentSlide;
|
1257
|
+
rangeStart = Math.max(0, _.currentSlide - (_.options.slidesToShow / 2 + 1));
|
1258
|
+
rangeEnd = 2 + (_.options.slidesToShow / 2 + 1) + _.currentSlide;
|
1169
1259
|
}
|
1170
1260
|
} else {
|
1171
1261
|
rangeStart = _.options.infinite ? _.options.slidesToShow + _.currentSlide : _.currentSlide;
|
1172
1262
|
rangeEnd = rangeStart + _.options.slidesToShow;
|
1173
|
-
if (_.options.fade === true
|
1174
|
-
if(rangeStart > 0) rangeStart--;
|
1175
|
-
if(rangeEnd <= _.slideCount) rangeEnd++;
|
1263
|
+
if (_.options.fade === true) {
|
1264
|
+
if (rangeStart > 0) rangeStart--;
|
1265
|
+
if (rangeEnd <= _.slideCount) rangeEnd++;
|
1176
1266
|
}
|
1177
1267
|
}
|
1178
1268
|
|
1179
1269
|
loadRange = _.$slider.find('.slick-slide').slice(rangeStart, rangeEnd);
|
1180
1270
|
loadImages(loadRange);
|
1181
1271
|
|
1182
|
-
|
1183
|
-
|
1184
|
-
|
1185
|
-
|
1272
|
+
if (_.slideCount <= _.options.slidesToShow) {
|
1273
|
+
cloneRange = _.$slider.find('.slick-slide');
|
1274
|
+
loadImages(cloneRange);
|
1275
|
+
} else
|
1186
1276
|
if (_.currentSlide >= _.slideCount - _.options.slidesToShow) {
|
1187
1277
|
cloneRange = _.$slider.find('.slick-cloned').slice(0, _.options.slidesToShow);
|
1188
1278
|
loadImages(cloneRange);
|
@@ -1225,6 +1315,15 @@
|
|
1225
1315
|
|
1226
1316
|
};
|
1227
1317
|
|
1318
|
+
Slick.prototype.orientationChange = function() {
|
1319
|
+
|
1320
|
+
var _ = this;
|
1321
|
+
|
1322
|
+
_.checkResponsive();
|
1323
|
+
_.setPosition();
|
1324
|
+
|
1325
|
+
};
|
1326
|
+
|
1228
1327
|
Slick.prototype.pause = Slick.prototype.slickPause = function() {
|
1229
1328
|
|
1230
1329
|
var _ = this;
|
@@ -1247,7 +1346,7 @@
|
|
1247
1346
|
|
1248
1347
|
var _ = this;
|
1249
1348
|
|
1250
|
-
_.$slider.trigger(
|
1349
|
+
_.$slider.trigger('afterChange', [_, index]);
|
1251
1350
|
|
1252
1351
|
_.animating = false;
|
1253
1352
|
|
@@ -1273,6 +1372,10 @@
|
|
1273
1372
|
|
1274
1373
|
};
|
1275
1374
|
|
1375
|
+
Slick.prototype.preventDefault = function(e) {
|
1376
|
+
e.preventDefault();
|
1377
|
+
};
|
1378
|
+
|
1276
1379
|
Slick.prototype.progressiveLazyLoad = function() {
|
1277
1380
|
|
1278
1381
|
var _ = this,
|
@@ -1283,17 +1386,17 @@
|
|
1283
1386
|
if (imgCount > 0) {
|
1284
1387
|
targetImage = $('img[data-lazy]', _.$slider).first();
|
1285
1388
|
targetImage.attr('src', targetImage.attr('data-lazy')).removeClass('slick-loading').load(function() {
|
1286
|
-
|
1287
|
-
|
1389
|
+
targetImage.removeAttr('data-lazy');
|
1390
|
+
_.progressiveLazyLoad();
|
1288
1391
|
|
1289
|
-
|
1290
|
-
|
1291
|
-
|
1292
|
-
|
1293
|
-
|
1294
|
-
|
1295
|
-
|
1296
|
-
|
1392
|
+
if (_.options.adaptiveHeight === true) {
|
1393
|
+
_.setPosition();
|
1394
|
+
}
|
1395
|
+
})
|
1396
|
+
.error(function() {
|
1397
|
+
targetImage.removeAttr('data-lazy');
|
1398
|
+
_.progressiveLazyLoad();
|
1399
|
+
});
|
1297
1400
|
}
|
1298
1401
|
|
1299
1402
|
};
|
@@ -1314,7 +1417,7 @@
|
|
1314
1417
|
message: 'index',
|
1315
1418
|
index: currentSlide
|
1316
1419
|
}
|
1317
|
-
},
|
1420
|
+
}, false);
|
1318
1421
|
|
1319
1422
|
};
|
1320
1423
|
|
@@ -1351,7 +1454,7 @@
|
|
1351
1454
|
|
1352
1455
|
_.initDotEvents();
|
1353
1456
|
|
1354
|
-
if(_.options.focusOnSelect === true) {
|
1457
|
+
if (_.options.focusOnSelect === true) {
|
1355
1458
|
$(_.$slideTrack).children().on('click.slick', _.selectHandler);
|
1356
1459
|
}
|
1357
1460
|
|
@@ -1359,10 +1462,24 @@
|
|
1359
1462
|
|
1360
1463
|
_.setPosition();
|
1361
1464
|
|
1362
|
-
_.$slider.trigger(
|
1465
|
+
_.$slider.trigger('reInit', [_]);
|
1363
1466
|
|
1364
1467
|
};
|
1365
1468
|
|
1469
|
+
Slick.prototype.resize = function() {
|
1470
|
+
|
1471
|
+
var _ = this;
|
1472
|
+
|
1473
|
+
if ($(window).width() !== _.windowWidth) {
|
1474
|
+
clearTimeout(_.windowDelay);
|
1475
|
+
_.windowDelay = window.setTimeout(function() {
|
1476
|
+
_.windowWidth = $(window).width();
|
1477
|
+
_.checkResponsive();
|
1478
|
+
_.setPosition();
|
1479
|
+
}, 50);
|
1480
|
+
}
|
1481
|
+
};
|
1482
|
+
|
1366
1483
|
Slick.prototype.removeSlide = Slick.prototype.slickRemove = function(index, removeBefore, removeAll) {
|
1367
1484
|
|
1368
1485
|
var _ = this;
|
@@ -1380,7 +1497,7 @@
|
|
1380
1497
|
|
1381
1498
|
_.unload();
|
1382
1499
|
|
1383
|
-
if(removeAll === true) {
|
1500
|
+
if (removeAll === true) {
|
1384
1501
|
_.$slideTrack.children().remove();
|
1385
1502
|
} else {
|
1386
1503
|
_.$slideTrack.children(this.options.slide).eq(index).remove();
|
@@ -1401,7 +1518,8 @@
|
|
1401
1518
|
Slick.prototype.setCSS = function(position) {
|
1402
1519
|
|
1403
1520
|
var _ = this,
|
1404
|
-
positionProps = {},
|
1521
|
+
positionProps = {},
|
1522
|
+
x, y;
|
1405
1523
|
|
1406
1524
|
if (_.options.rtl === true) {
|
1407
1525
|
position = -position;
|
@@ -1449,17 +1567,12 @@
|
|
1449
1567
|
_.listHeight = _.$list.height();
|
1450
1568
|
|
1451
1569
|
|
1452
|
-
if(_.options.vertical === false && _.options.variableWidth === false) {
|
1570
|
+
if (_.options.vertical === false && _.options.variableWidth === false) {
|
1453
1571
|
_.slideWidth = Math.ceil(_.listWidth / _.options.slidesToShow);
|
1454
1572
|
_.$slideTrack.width(Math.ceil((_.slideWidth * _.$slideTrack.children('.slick-slide').length)));
|
1455
1573
|
|
1456
1574
|
} else if (_.options.variableWidth === true) {
|
1457
|
-
|
1458
|
-
_.slideWidth = Math.ceil(_.listWidth / _.options.slidesToShow);
|
1459
|
-
_.$slideTrack.children('.slick-slide').each(function(){
|
1460
|
-
trackWidth += _.listWidth;
|
1461
|
-
});
|
1462
|
-
_.$slideTrack.width(Math.ceil(trackWidth) + 1);
|
1575
|
+
_.$slideTrack.width(5000 * _.slideCount);
|
1463
1576
|
} else {
|
1464
1577
|
_.slideWidth = Math.ceil(_.listWidth);
|
1465
1578
|
_.$slideTrack.height(Math.ceil((_.$slides.first().outerHeight(true) * _.$slideTrack.children('.slick-slide').length)));
|
@@ -1507,7 +1620,7 @@
|
|
1507
1620
|
|
1508
1621
|
var _ = this;
|
1509
1622
|
|
1510
|
-
if(_.options.slidesToShow === 1 && _.options.adaptiveHeight === true && _.options.vertical === false) {
|
1623
|
+
if (_.options.slidesToShow === 1 && _.options.adaptiveHeight === true && _.options.vertical === false) {
|
1511
1624
|
var targetHeight = _.$slides.eq(_.currentSlide).outerHeight(true);
|
1512
1625
|
_.$list.css('height', targetHeight);
|
1513
1626
|
}
|
@@ -1540,7 +1653,7 @@
|
|
1540
1653
|
_.setFade();
|
1541
1654
|
}
|
1542
1655
|
|
1543
|
-
_.$slider.trigger(
|
1656
|
+
_.$slider.trigger('setPosition', [_]);
|
1544
1657
|
|
1545
1658
|
};
|
1546
1659
|
|
@@ -1560,38 +1673,38 @@
|
|
1560
1673
|
if (bodyStyle.WebkitTransition !== undefined ||
|
1561
1674
|
bodyStyle.MozTransition !== undefined ||
|
1562
1675
|
bodyStyle.msTransition !== undefined) {
|
1563
|
-
if(_.options.useCSS === true) {
|
1676
|
+
if (_.options.useCSS === true) {
|
1564
1677
|
_.cssTransitions = true;
|
1565
1678
|
}
|
1566
1679
|
}
|
1567
1680
|
|
1568
1681
|
if (bodyStyle.OTransform !== undefined) {
|
1569
1682
|
_.animType = 'OTransform';
|
1570
|
-
_.transformType =
|
1683
|
+
_.transformType = '-o-transform';
|
1571
1684
|
_.transitionType = 'OTransition';
|
1572
1685
|
if (bodyStyle.perspectiveProperty === undefined && bodyStyle.webkitPerspective === undefined) _.animType = false;
|
1573
1686
|
}
|
1574
1687
|
if (bodyStyle.MozTransform !== undefined) {
|
1575
1688
|
_.animType = 'MozTransform';
|
1576
|
-
_.transformType =
|
1689
|
+
_.transformType = '-moz-transform';
|
1577
1690
|
_.transitionType = 'MozTransition';
|
1578
1691
|
if (bodyStyle.perspectiveProperty === undefined && bodyStyle.MozPerspective === undefined) _.animType = false;
|
1579
1692
|
}
|
1580
1693
|
if (bodyStyle.webkitTransform !== undefined) {
|
1581
1694
|
_.animType = 'webkitTransform';
|
1582
|
-
_.transformType =
|
1695
|
+
_.transformType = '-webkit-transform';
|
1583
1696
|
_.transitionType = 'webkitTransition';
|
1584
1697
|
if (bodyStyle.perspectiveProperty === undefined && bodyStyle.webkitPerspective === undefined) _.animType = false;
|
1585
1698
|
}
|
1586
1699
|
if (bodyStyle.msTransform !== undefined) {
|
1587
1700
|
_.animType = 'msTransform';
|
1588
|
-
_.transformType =
|
1701
|
+
_.transformType = '-ms-transform';
|
1589
1702
|
_.transitionType = 'msTransition';
|
1590
1703
|
if (bodyStyle.msTransform === undefined) _.animType = false;
|
1591
1704
|
}
|
1592
1705
|
if (bodyStyle.transform !== undefined && _.animType !== false) {
|
1593
1706
|
_.animType = 'transform';
|
1594
|
-
_.transformType =
|
1707
|
+
_.transformType = 'transform';
|
1595
1708
|
_.transitionType = 'transition';
|
1596
1709
|
}
|
1597
1710
|
_.transformsEnabled = (_.animType !== null && _.animType !== false);
|
@@ -1604,20 +1717,20 @@
|
|
1604
1717
|
var _ = this,
|
1605
1718
|
centerOffset, allSlides, indexOffset, remainder;
|
1606
1719
|
|
1607
|
-
_.$slider.find('.slick-slide').removeClass('slick-active').attr(
|
1720
|
+
_.$slider.find('.slick-slide').removeClass('slick-active').attr('aria-hidden', 'true').removeClass('slick-center');
|
1608
1721
|
allSlides = _.$slider.find('.slick-slide');
|
1609
1722
|
|
1610
1723
|
if (_.options.centerMode === true) {
|
1611
1724
|
|
1612
1725
|
centerOffset = Math.floor(_.options.slidesToShow / 2);
|
1613
1726
|
|
1614
|
-
if(_.options.infinite === true) {
|
1727
|
+
if (_.options.infinite === true) {
|
1615
1728
|
|
1616
1729
|
if (index >= centerOffset && index <= (_.slideCount - 1) - centerOffset) {
|
1617
|
-
_.$slides.slice(index - centerOffset, index + centerOffset + 1).addClass('slick-active').attr(
|
1730
|
+
_.$slides.slice(index - centerOffset, index + centerOffset + 1).addClass('slick-active').attr('aria-hidden', 'false');
|
1618
1731
|
} else {
|
1619
1732
|
indexOffset = _.options.slidesToShow + index;
|
1620
|
-
allSlides.slice(indexOffset - centerOffset + 1, indexOffset + centerOffset + 2).addClass('slick-active').attr(
|
1733
|
+
allSlides.slice(indexOffset - centerOffset + 1, indexOffset + centerOffset + 2).addClass('slick-active').attr('aria-hidden', 'false');
|
1621
1734
|
}
|
1622
1735
|
|
1623
1736
|
if (index === 0) {
|
@@ -1633,16 +1746,16 @@
|
|
1633
1746
|
} else {
|
1634
1747
|
|
1635
1748
|
if (index >= 0 && index <= (_.slideCount - _.options.slidesToShow)) {
|
1636
|
-
_.$slides.slice(index, index + _.options.slidesToShow).addClass('slick-active').attr(
|
1637
|
-
} else if (
|
1638
|
-
allSlides.addClass('slick-active').attr(
|
1749
|
+
_.$slides.slice(index, index + _.options.slidesToShow).addClass('slick-active').attr('aria-hidden', 'false');
|
1750
|
+
} else if (allSlides.length <= _.options.slidesToShow) {
|
1751
|
+
allSlides.addClass('slick-active').attr('aria-hidden', 'false');
|
1639
1752
|
} else {
|
1640
|
-
remainder = _.slideCount%_.options.slidesToShow;
|
1753
|
+
remainder = _.slideCount % _.options.slidesToShow;
|
1641
1754
|
indexOffset = _.options.infinite === true ? _.options.slidesToShow + index : index;
|
1642
|
-
if(_.options.slidesToShow == _.options.slidesToScroll && (_.slideCount - index) < _.options.slidesToShow) {
|
1643
|
-
allSlides.slice(indexOffset-(_.options.slidesToShow-remainder), indexOffset + remainder).addClass('slick-active').attr(
|
1755
|
+
if (_.options.slidesToShow == _.options.slidesToScroll && (_.slideCount - index) < _.options.slidesToShow) {
|
1756
|
+
allSlides.slice(indexOffset - (_.options.slidesToShow - remainder), indexOffset + remainder).addClass('slick-active').attr('aria-hidden', 'false');
|
1644
1757
|
} else {
|
1645
|
-
allSlides.slice(indexOffset, indexOffset + _.options.slidesToShow).addClass('slick-active').attr(
|
1758
|
+
allSlides.slice(indexOffset, indexOffset + _.options.slidesToShow).addClass('slick-active').attr('aria-hidden', 'false');
|
1646
1759
|
}
|
1647
1760
|
}
|
1648
1761
|
|
@@ -1676,16 +1789,16 @@
|
|
1676
1789
|
}
|
1677
1790
|
|
1678
1791
|
for (i = _.slideCount; i > (_.slideCount -
|
1679
|
-
|
1792
|
+
infiniteCount); i -= 1) {
|
1680
1793
|
slideIndex = i - 1;
|
1681
1794
|
$(_.$slides[slideIndex]).clone(true).attr('id', '')
|
1682
|
-
.attr('data-slick-index', slideIndex-_.slideCount)
|
1795
|
+
.attr('data-slick-index', slideIndex - _.slideCount)
|
1683
1796
|
.prependTo(_.$slideTrack).addClass('slick-cloned');
|
1684
1797
|
}
|
1685
1798
|
for (i = 0; i < infiniteCount; i += 1) {
|
1686
1799
|
slideIndex = i;
|
1687
1800
|
$(_.$slides[slideIndex]).clone(true).attr('id', '')
|
1688
|
-
.attr('data-slick-index', slideIndex+_.slideCount)
|
1801
|
+
.attr('data-slick-index', slideIndex + _.slideCount)
|
1689
1802
|
.appendTo(_.$slideTrack).addClass('slick-cloned');
|
1690
1803
|
}
|
1691
1804
|
_.$slideTrack.find('.slick-cloned').find('[id]').each(function() {
|
@@ -1698,16 +1811,32 @@
|
|
1698
1811
|
|
1699
1812
|
};
|
1700
1813
|
|
1814
|
+
Slick.prototype.setPaused = function(paused) {
|
1815
|
+
|
1816
|
+
var _ = this;
|
1817
|
+
|
1818
|
+
if (_.options.autoplay === true && _.options.pauseOnHover === true) {
|
1819
|
+
_.paused = paused;
|
1820
|
+
_.autoPlayClear();
|
1821
|
+
}
|
1822
|
+
};
|
1823
|
+
|
1701
1824
|
Slick.prototype.selectHandler = function(event) {
|
1702
1825
|
|
1703
1826
|
var _ = this;
|
1704
|
-
var index = parseInt($(event.target).parents('.slick-slide').attr("data-slick-index"));
|
1705
|
-
if(!index) index = 0;
|
1706
1827
|
|
1707
|
-
|
1708
|
-
|
1709
|
-
|
1710
|
-
|
1828
|
+
var targetElement = $(event.target).is('.slick-slide') ?
|
1829
|
+
$(event.target) :
|
1830
|
+
$(event.target).parents('.slick-slide');
|
1831
|
+
|
1832
|
+
var index = parseInt(targetElement.attr('data-slick-index'));
|
1833
|
+
|
1834
|
+
if (!index) index = 0;
|
1835
|
+
|
1836
|
+
if (_.slideCount <= _.options.slidesToShow) {
|
1837
|
+
_.$slider.find('.slick-slide').removeClass('slick-active').attr('aria-hidden', 'true');
|
1838
|
+
_.$slides.eq(index).addClass('slick-active').attr("aria-hidden", "false");
|
1839
|
+
if (_.options.centerMode === true) {
|
1711
1840
|
_.$slider.find('.slick-slide').removeClass('slick-center');
|
1712
1841
|
_.$slides.eq(index).addClass('slick-center');
|
1713
1842
|
}
|
@@ -1718,7 +1847,7 @@
|
|
1718
1847
|
|
1719
1848
|
};
|
1720
1849
|
|
1721
|
-
Slick.prototype.slideHandler = function(index,sync,dontAnimate) {
|
1850
|
+
Slick.prototype.slideHandler = function(index, sync, dontAnimate) {
|
1722
1851
|
|
1723
1852
|
var targetSlide, animSlide, oldSlide, slideLeft, targetLeft = null,
|
1724
1853
|
_ = this;
|
@@ -1748,9 +1877,9 @@
|
|
1748
1877
|
_.currentLeft = _.swipeLeft === null ? slideLeft : _.swipeLeft;
|
1749
1878
|
|
1750
1879
|
if (_.options.infinite === false && _.options.centerMode === false && (index < 0 || index > _.getDotCount() * _.options.slidesToScroll)) {
|
1751
|
-
if(_.options.fade === false) {
|
1880
|
+
if (_.options.fade === false) {
|
1752
1881
|
targetSlide = _.currentSlide;
|
1753
|
-
if(dontAnimate!==true) {
|
1882
|
+
if (dontAnimate !== true) {
|
1754
1883
|
_.animateSlide(slideLeft, function() {
|
1755
1884
|
_.postSlide(targetSlide);
|
1756
1885
|
});
|
@@ -1760,9 +1889,9 @@
|
|
1760
1889
|
}
|
1761
1890
|
return;
|
1762
1891
|
} else if (_.options.infinite === false && _.options.centerMode === true && (index < 0 || index > (_.slideCount - _.options.slidesToScroll))) {
|
1763
|
-
if(_.options.fade === false) {
|
1892
|
+
if (_.options.fade === false) {
|
1764
1893
|
targetSlide = _.currentSlide;
|
1765
|
-
if(dontAnimate!==true) {
|
1894
|
+
if (dontAnimate !== true) {
|
1766
1895
|
_.animateSlide(slideLeft, function() {
|
1767
1896
|
_.postSlide(targetSlide);
|
1768
1897
|
});
|
@@ -1795,7 +1924,7 @@
|
|
1795
1924
|
|
1796
1925
|
_.animating = true;
|
1797
1926
|
|
1798
|
-
_.$slider.trigger("beforeChange", [
|
1927
|
+
_.$slider.trigger("beforeChange", [_, _.currentSlide, animSlide]);
|
1799
1928
|
|
1800
1929
|
oldSlide = _.currentSlide;
|
1801
1930
|
_.currentSlide = animSlide;
|
@@ -1806,7 +1935,7 @@
|
|
1806
1935
|
_.updateArrows();
|
1807
1936
|
|
1808
1937
|
if (_.options.fade === true) {
|
1809
|
-
if(dontAnimate!==true) {
|
1938
|
+
if (dontAnimate !== true) {
|
1810
1939
|
_.fadeSlide(animSlide, function() {
|
1811
1940
|
_.postSlide(animSlide);
|
1812
1941
|
});
|
@@ -1817,7 +1946,7 @@
|
|
1817
1946
|
return;
|
1818
1947
|
}
|
1819
1948
|
|
1820
|
-
if(dontAnimate!==true) {
|
1949
|
+
if (dontAnimate !== true) {
|
1821
1950
|
_.animateSlide(targetLeft, function() {
|
1822
1951
|
_.postSlide(animSlide);
|
1823
1952
|
});
|
@@ -1870,6 +1999,13 @@
|
|
1870
1999
|
if ((swipeAngle >= 135) && (swipeAngle <= 225)) {
|
1871
2000
|
return (_.options.rtl === false ? 'right' : 'left');
|
1872
2001
|
}
|
2002
|
+
if (_.options.verticalSwiping === true) {
|
2003
|
+
if ((swipeAngle >= 35) && (swipeAngle <= 135)) {
|
2004
|
+
return 'left';
|
2005
|
+
} else {
|
2006
|
+
return 'right';
|
2007
|
+
}
|
2008
|
+
}
|
1873
2009
|
|
1874
2010
|
return 'vertical';
|
1875
2011
|
|
@@ -1877,7 +2013,8 @@
|
|
1877
2013
|
|
1878
2014
|
Slick.prototype.swipeEnd = function(event) {
|
1879
2015
|
|
1880
|
-
var _ = this,
|
2016
|
+
var _ = this,
|
2017
|
+
slideCount;
|
1881
2018
|
|
1882
2019
|
_.dragging = false;
|
1883
2020
|
|
@@ -1888,7 +2025,7 @@
|
|
1888
2025
|
}
|
1889
2026
|
|
1890
2027
|
if (_.touchObject.edgeHit === true) {
|
1891
|
-
_.$slider.trigger("edge", [
|
2028
|
+
_.$slider.trigger("edge", [_, _.swipeDirection()]);
|
1892
2029
|
}
|
1893
2030
|
|
1894
2031
|
if (_.touchObject.swipeLength >= _.touchObject.minSwipe) {
|
@@ -1899,7 +2036,7 @@
|
|
1899
2036
|
_.slideHandler(slideCount);
|
1900
2037
|
_.currentDirection = 0;
|
1901
2038
|
_.touchObject = {};
|
1902
|
-
_.$slider.trigger("swipe", [
|
2039
|
+
_.$slider.trigger("swipe", [_, "left"]);
|
1903
2040
|
break;
|
1904
2041
|
|
1905
2042
|
case 'right':
|
@@ -1907,11 +2044,11 @@
|
|
1907
2044
|
_.slideHandler(slideCount);
|
1908
2045
|
_.currentDirection = 1;
|
1909
2046
|
_.touchObject = {};
|
1910
|
-
_.$slider.trigger("swipe", [
|
2047
|
+
_.$slider.trigger("swipe", [_, "right"]);
|
1911
2048
|
break;
|
1912
2049
|
}
|
1913
2050
|
} else {
|
1914
|
-
if(_.touchObject.startX !== _.touchObject.curX) {
|
2051
|
+
if (_.touchObject.startX !== _.touchObject.curX) {
|
1915
2052
|
_.slideHandler(_.currentSlide);
|
1916
2053
|
_.touchObject = {};
|
1917
2054
|
}
|
@@ -1924,9 +2061,9 @@
|
|
1924
2061
|
var _ = this;
|
1925
2062
|
|
1926
2063
|
if ((_.options.swipe === false) || ('ontouchend' in document && _.options.swipe === false)) {
|
1927
|
-
|
2064
|
+
return;
|
1928
2065
|
} else if (_.options.draggable === false && event.type.indexOf('mouse') !== -1) {
|
1929
|
-
|
2066
|
+
return;
|
1930
2067
|
}
|
1931
2068
|
|
1932
2069
|
_.touchObject.fingerCount = event.originalEvent && event.originalEvent.touches !== undefined ?
|
@@ -1935,6 +2072,11 @@
|
|
1935
2072
|
_.touchObject.minSwipe = _.listWidth / _.options
|
1936
2073
|
.touchThreshold;
|
1937
2074
|
|
2075
|
+
if (_.options.verticalSwiping === true) {
|
2076
|
+
_.touchObject.minSwipe = _.listHeight / _.options
|
2077
|
+
.touchThreshold;
|
2078
|
+
}
|
2079
|
+
|
1938
2080
|
switch (event.data.action) {
|
1939
2081
|
|
1940
2082
|
case 'start':
|
@@ -1973,6 +2115,11 @@
|
|
1973
2115
|
_.touchObject.swipeLength = Math.round(Math.sqrt(
|
1974
2116
|
Math.pow(_.touchObject.curX - _.touchObject.startX, 2)));
|
1975
2117
|
|
2118
|
+
if (_.options.verticalSwiping === true) {
|
2119
|
+
_.touchObject.swipeLength = Math.round(Math.sqrt(
|
2120
|
+
Math.pow(_.touchObject.curY - _.touchObject.startY, 2)));
|
2121
|
+
}
|
2122
|
+
|
1976
2123
|
swipeDirection = _.swipeDirection();
|
1977
2124
|
|
1978
2125
|
if (swipeDirection === 'vertical') {
|
@@ -1984,6 +2131,10 @@
|
|
1984
2131
|
}
|
1985
2132
|
|
1986
2133
|
positionOffset = (_.options.rtl === false ? 1 : -1) * (_.touchObject.curX > _.touchObject.startX ? 1 : -1);
|
2134
|
+
if (_.options.verticalSwiping === true) {
|
2135
|
+
positionOffset = _.touchObject.curY > _.touchObject.startY ? 1 : -1;
|
2136
|
+
}
|
2137
|
+
|
1987
2138
|
|
1988
2139
|
swipeLength = _.touchObject.swipeLength;
|
1989
2140
|
|
@@ -2001,6 +2152,9 @@
|
|
2001
2152
|
} else {
|
2002
2153
|
_.swipeLeft = curLeft + (swipeLength * (_.$list.height() / _.listWidth)) * positionOffset;
|
2003
2154
|
}
|
2155
|
+
if (_.options.verticalSwiping === true) {
|
2156
|
+
_.swipeLeft = curLeft + swipeLength * positionOffset;
|
2157
|
+
}
|
2004
2158
|
|
2005
2159
|
if (_.options.fade === true || _.options.touchMove === false) {
|
2006
2160
|
return false;
|
@@ -2068,7 +2222,7 @@
|
|
2068
2222
|
if (_.$nextArrow && (typeof _.options.nextArrow !== 'object')) {
|
2069
2223
|
_.$nextArrow.remove();
|
2070
2224
|
}
|
2071
|
-
_.$slides.removeClass('slick-slide slick-active slick-visible').attr("aria-hidden","true").css('width', '');
|
2225
|
+
_.$slides.removeClass('slick-slide slick-active slick-visible').attr("aria-hidden", "true").css('width', '');
|
2072
2226
|
|
2073
2227
|
};
|
2074
2228
|
|
@@ -2081,7 +2235,8 @@
|
|
2081
2235
|
|
2082
2236
|
Slick.prototype.updateArrows = function() {
|
2083
2237
|
|
2084
|
-
var _ = this,
|
2238
|
+
var _ = this,
|
2239
|
+
centerOffset;
|
2085
2240
|
|
2086
2241
|
centerOffset = Math.floor(_.options.slidesToShow / 2);
|
2087
2242
|
|
@@ -2109,8 +2264,8 @@
|
|
2109
2264
|
|
2110
2265
|
if (_.$dots !== null) {
|
2111
2266
|
|
2112
|
-
_.$dots.find('li').removeClass('slick-active').attr("aria-hidden","true");
|
2113
|
-
_.$dots.find('li').eq(Math.floor(_.currentSlide / _.options.slidesToScroll)).addClass('slick-active').attr("aria-hidden","false");
|
2267
|
+
_.$dots.find('li').removeClass('slick-active').attr("aria-hidden", "true");
|
2268
|
+
_.$dots.find('li').eq(Math.floor(_.currentSlide / _.options.slidesToScroll)).addClass('slick-active').attr("aria-hidden", "false");
|
2114
2269
|
|
2115
2270
|
}
|
2116
2271
|
|
@@ -2120,7 +2275,7 @@
|
|
2120
2275
|
|
2121
2276
|
var _ = this;
|
2122
2277
|
|
2123
|
-
if(
|
2278
|
+
if (document[_.hidden]) {
|
2124
2279
|
_.paused = true;
|
2125
2280
|
_.autoPlayClear();
|
2126
2281
|
} else {
|
@@ -2131,19 +2286,20 @@
|
|
2131
2286
|
};
|
2132
2287
|
|
2133
2288
|
$.fn.slick = function() {
|
2134
|
-
var _ = this,
|
2135
|
-
|
2289
|
+
var _ = this,
|
2290
|
+
opt = arguments[0],
|
2291
|
+
args = Array.prototype.slice.call(arguments, 1),
|
2292
|
+
l = _.length,
|
2293
|
+
i = 0,
|
2294
|
+
ret;
|
2295
|
+
for (i; i < l; i++) {
|
2136
2296
|
if (typeof opt == 'object' || typeof opt == 'undefined')
|
2137
|
-
_[i].slick =
|
2297
|
+
_[i].slick = new Slick(_[i], opt);
|
2138
2298
|
else
|
2139
2299
|
ret = _[i].slick[opt].apply(_[i].slick, args);
|
2140
|
-
|
2300
|
+
if (typeof ret != 'undefined') return ret;
|
2141
2301
|
}
|
2142
2302
|
return _;
|
2143
2303
|
};
|
2144
2304
|
|
2145
|
-
$(function(){
|
2146
|
-
$('[data-slick]').slick();
|
2147
|
-
});
|
2148
|
-
|
2149
2305
|
}));
|
data/lib/slick_rails/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: slick_rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Guy Israeli
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-04-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|