jquery-slick-rails 1.5.5 → 1.5.6
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 +4 -4
- data/app/assets/javascripts/jquery.slick.js +416 -142
- data/app/assets/stylesheets/slick.css +3 -0
- data/lib/jquery-slick-rails/version.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7a48376d4d3e5ed542f11b82c43d6b356e92700d
|
4
|
+
data.tar.gz: 3e2ad7dd6c16674a9ca7f073b5f80764bc40ea33
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c24480672e9aecd3c189c80ff4eee846374b8aca07f1838bb70aa0bcd17ff544efcd882a88c7536679960d6f9355de19b3a240043103cb9b9821773feb12bb66
|
7
|
+
data.tar.gz: 93a3ab8c9d475f61d324c377d6bee632c94664f7a9f2ac064633715191a0d07ff4262543509d568abb01d2e391fb2dfcef1f4d094aecdb662a4e2b770c2d9a27
|
@@ -6,7 +6,7 @@
|
|
6
6
|
|___/_|_|\___|_|\_(_)/ |___/
|
7
7
|
|__/
|
8
8
|
|
9
|
-
Version: 1.5.
|
9
|
+
Version: 1.5.6
|
10
10
|
Author: Ken Wheeler
|
11
11
|
Website: http://kenwheeler.github.io
|
12
12
|
Docs: http://kenwheeler.github.io/slick
|
@@ -35,8 +35,7 @@
|
|
35
35
|
|
36
36
|
function Slick(element, settings) {
|
37
37
|
|
38
|
-
var _ = this,
|
39
|
-
dataSettings, responsiveSettings, breakpoint;
|
38
|
+
var _ = this, dataSettings;
|
40
39
|
|
41
40
|
_.defaults = {
|
42
41
|
accessibility: true,
|
@@ -45,15 +44,15 @@
|
|
45
44
|
appendDots: $(element),
|
46
45
|
arrows: true,
|
47
46
|
asNavFor: null,
|
48
|
-
prevArrow: '<button type="button" data-role="none" class="slick-prev" aria-label="
|
49
|
-
nextArrow: '<button type="button" data-role="none" class="slick-next" aria-label="
|
47
|
+
prevArrow: '<button type="button" data-role="none" class="slick-prev" aria-label="Previous" tabindex="0" role="button">Previous</button>',
|
48
|
+
nextArrow: '<button type="button" data-role="none" class="slick-next" aria-label="Next" tabindex="0" role="button">Next</button>',
|
50
49
|
autoplay: false,
|
51
50
|
autoplaySpeed: 3000,
|
52
51
|
centerMode: false,
|
53
52
|
centerPadding: '50px',
|
54
53
|
cssEase: 'ease',
|
55
54
|
customPaging: function(slider, i) {
|
56
|
-
return '<button type="button" data-role="none">' + (i + 1) + '</button>';
|
55
|
+
return '<button type="button" data-role="none" role="button" aria-required="false" tabindex="0">' + (i + 1) + '</button>';
|
57
56
|
},
|
58
57
|
dots: false,
|
59
58
|
dotsClass: 'slick-dots',
|
@@ -85,7 +84,8 @@
|
|
85
84
|
variableWidth: false,
|
86
85
|
vertical: false,
|
87
86
|
verticalSwiping: false,
|
88
|
-
waitForAnimate: true
|
87
|
+
waitForAnimate: true,
|
88
|
+
zIndex: 1000
|
89
89
|
};
|
90
90
|
|
91
91
|
_.initials = {
|
@@ -144,27 +144,6 @@
|
|
144
144
|
_.currentSlide = _.options.initialSlide;
|
145
145
|
|
146
146
|
_.originalSettings = _.options;
|
147
|
-
responsiveSettings = _.options.responsive || null;
|
148
|
-
|
149
|
-
if (responsiveSettings && responsiveSettings.length > -1) {
|
150
|
-
_.respondTo = _.options.respondTo || 'window';
|
151
|
-
for (breakpoint in responsiveSettings) {
|
152
|
-
if (responsiveSettings.hasOwnProperty(breakpoint)) {
|
153
|
-
_.breakpoints.push(responsiveSettings[
|
154
|
-
breakpoint].breakpoint);
|
155
|
-
_.breakpointSettings[responsiveSettings[
|
156
|
-
breakpoint].breakpoint] =
|
157
|
-
responsiveSettings[breakpoint].settings;
|
158
|
-
}
|
159
|
-
}
|
160
|
-
_.breakpoints.sort(function(a, b) {
|
161
|
-
if (_.options.mobileFirst === true) {
|
162
|
-
return a - b;
|
163
|
-
} else {
|
164
|
-
return b - a;
|
165
|
-
}
|
166
|
-
});
|
167
|
-
}
|
168
147
|
|
169
148
|
if (typeof document.mozHidden !== 'undefined') {
|
170
149
|
_.hidden = 'mozHidden';
|
@@ -192,8 +171,9 @@
|
|
192
171
|
// Extracted from jQuery v1.11 source
|
193
172
|
_.htmlExpr = /^(?:\s*(<[\w\W]+>)[^>]*)$/;
|
194
173
|
|
195
|
-
_.init(true);
|
196
174
|
|
175
|
+
_.registerBreakpoints();
|
176
|
+
_.init(true);
|
197
177
|
_.checkResponsive(true);
|
198
178
|
|
199
179
|
}
|
@@ -346,7 +326,7 @@
|
|
346
326
|
asNavFor = $(asNavFor).not(_.$slider);
|
347
327
|
}
|
348
328
|
|
349
|
-
if ( asNavFor !== null && typeof asNavFor ===
|
329
|
+
if ( asNavFor !== null && typeof asNavFor === 'object' ) {
|
350
330
|
asNavFor.each(function() {
|
351
331
|
var target = $(this).slick('getSlick');
|
352
332
|
if(!target.unslicked) {
|
@@ -439,21 +419,40 @@
|
|
439
419
|
|
440
420
|
var _ = this;
|
441
421
|
|
442
|
-
if (_.options.arrows === true
|
422
|
+
if (_.options.arrows === true ) {
|
443
423
|
|
444
|
-
_.$prevArrow = $(_.options.prevArrow);
|
445
|
-
_.$nextArrow = $(_.options.nextArrow);
|
424
|
+
_.$prevArrow = $(_.options.prevArrow).addClass('slick-arrow');
|
425
|
+
_.$nextArrow = $(_.options.nextArrow).addClass('slick-arrow');
|
446
426
|
|
447
|
-
if
|
448
|
-
_.$prevArrow.appendTo(_.options.appendArrows);
|
449
|
-
}
|
427
|
+
if( _.slideCount > _.options.slidesToShow ) {
|
450
428
|
|
451
|
-
|
452
|
-
_.$nextArrow.
|
453
|
-
|
429
|
+
_.$prevArrow.removeClass('slick-hidden').removeAttr('aria-hidden tabindex');
|
430
|
+
_.$nextArrow.removeClass('slick-hidden').removeAttr('aria-hidden tabindex');
|
431
|
+
|
432
|
+
if (_.htmlExpr.test(_.options.prevArrow)) {
|
433
|
+
_.$prevArrow.prependTo(_.options.appendArrows);
|
434
|
+
}
|
435
|
+
|
436
|
+
if (_.htmlExpr.test(_.options.nextArrow)) {
|
437
|
+
_.$nextArrow.appendTo(_.options.appendArrows);
|
438
|
+
}
|
439
|
+
|
440
|
+
if (_.options.infinite !== true) {
|
441
|
+
_.$prevArrow
|
442
|
+
.addClass('slick-disabled')
|
443
|
+
.attr('aria-disabled', 'true');
|
444
|
+
}
|
445
|
+
|
446
|
+
} else {
|
447
|
+
|
448
|
+
_.$prevArrow.add( _.$nextArrow )
|
449
|
+
|
450
|
+
.addClass('slick-hidden')
|
451
|
+
.attr({
|
452
|
+
'aria-disabled': 'true',
|
453
|
+
'tabindex': '-1'
|
454
|
+
});
|
454
455
|
|
455
|
-
if (_.options.infinite !== true) {
|
456
|
-
_.$prevArrow.addClass('slick-disabled');
|
457
456
|
}
|
458
457
|
|
459
458
|
}
|
@@ -488,9 +487,11 @@
|
|
488
487
|
|
489
488
|
var _ = this;
|
490
489
|
|
491
|
-
_.$slides =
|
492
|
-
|
493
|
-
|
490
|
+
_.$slides =
|
491
|
+
_.$slider
|
492
|
+
.children( _.options.slide + ':not(.slick-cloned)')
|
493
|
+
.addClass('slick-slide');
|
494
|
+
|
494
495
|
_.slideCount = _.$slides.length;
|
495
496
|
|
496
497
|
_.$slides.each(function(index, element) {
|
@@ -525,11 +526,8 @@
|
|
525
526
|
|
526
527
|
_.updateDots();
|
527
528
|
|
528
|
-
if (_.options.accessibility === true) {
|
529
|
-
_.$list.prop('tabIndex', 0);
|
530
|
-
}
|
531
529
|
|
532
|
-
_.setSlideClasses(typeof
|
530
|
+
_.setSlideClasses(typeof _.currentSlide === 'number' ? _.currentSlide : 0);
|
533
531
|
|
534
532
|
if (_.options.draggable === true) {
|
535
533
|
_.$list.addClass('draggable');
|
@@ -545,6 +543,7 @@
|
|
545
543
|
originalSlides = _.$slider.children();
|
546
544
|
|
547
545
|
if(_.options.rows > 1) {
|
546
|
+
|
548
547
|
slidesPerSection = _.options.slidesPerRow * _.options.rows;
|
549
548
|
numOfSlides = Math.ceil(
|
550
549
|
originalSlides.length / slidesPerSection
|
@@ -563,18 +562,20 @@
|
|
563
562
|
slide.appendChild(row);
|
564
563
|
}
|
565
564
|
newSlides.appendChild(slide);
|
566
|
-
}
|
565
|
+
}
|
566
|
+
|
567
567
|
_.$slider.html(newSlides);
|
568
568
|
_.$slider.children().children().children()
|
569
569
|
.css({
|
570
|
-
'width':(100 / _.options.slidesPerRow) +
|
570
|
+
'width':(100 / _.options.slidesPerRow) + '%',
|
571
571
|
'display': 'inline-block'
|
572
572
|
});
|
573
|
-
|
573
|
+
|
574
|
+
}
|
574
575
|
|
575
576
|
};
|
576
577
|
|
577
|
-
Slick.prototype.checkResponsive = function(initial) {
|
578
|
+
Slick.prototype.checkResponsive = function(initial, forceUpdate) {
|
578
579
|
|
579
580
|
var _ = this,
|
580
581
|
breakpoint, targetBreakpoint, respondToWidth, triggerBreakpoint = false;
|
@@ -589,8 +590,9 @@
|
|
589
590
|
respondToWidth = Math.min(windowWidth, sliderWidth);
|
590
591
|
}
|
591
592
|
|
592
|
-
if (_.
|
593
|
-
|
593
|
+
if ( _.options.responsive &&
|
594
|
+
_.options.responsive.length &&
|
595
|
+
_.options.responsive !== null) {
|
594
596
|
|
595
597
|
targetBreakpoint = null;
|
596
598
|
|
@@ -610,7 +612,7 @@
|
|
610
612
|
|
611
613
|
if (targetBreakpoint !== null) {
|
612
614
|
if (_.activeBreakpoint !== null) {
|
613
|
-
if (targetBreakpoint !== _.activeBreakpoint) {
|
615
|
+
if (targetBreakpoint !== _.activeBreakpoint || forceUpdate) {
|
614
616
|
_.activeBreakpoint =
|
615
617
|
targetBreakpoint;
|
616
618
|
if (_.breakpointSettings[targetBreakpoint] === 'unslick') {
|
@@ -701,7 +703,7 @@
|
|
701
703
|
event.data.index || $target.index() * _.options.slidesToScroll;
|
702
704
|
|
703
705
|
_.slideHandler(_.checkNavigable(index), false, dontAnimate);
|
704
|
-
$target.children().trigger(
|
706
|
+
$target.children().trigger('focus');
|
705
707
|
break;
|
706
708
|
|
707
709
|
default:
|
@@ -824,17 +826,35 @@
|
|
824
826
|
if (_.$dots) {
|
825
827
|
_.$dots.remove();
|
826
828
|
}
|
827
|
-
|
828
|
-
|
829
|
+
|
830
|
+
if ( _.$prevArrow.length ) {
|
831
|
+
|
832
|
+
_.$prevArrow
|
833
|
+
.removeClass('slick-disabled slick-arrow slick-hidden')
|
834
|
+
.removeAttr('aria-hidden aria-disabled tabindex')
|
835
|
+
.css("display","");
|
836
|
+
|
837
|
+
if ( _.htmlExpr.test( _.options.prevArrow )) {
|
838
|
+
_.$prevArrow.remove();
|
839
|
+
}
|
829
840
|
}
|
830
|
-
|
831
|
-
|
841
|
+
|
842
|
+
if ( _.$nextArrow.length ) {
|
843
|
+
|
844
|
+
_.$nextArrow
|
845
|
+
.removeClass('slick-disabled slick-arrow slick-hidden')
|
846
|
+
.removeAttr('aria-hidden aria-disabled tabindex')
|
847
|
+
.css("display","");
|
848
|
+
|
849
|
+
if ( _.htmlExpr.test( _.options.nextArrow )) {
|
850
|
+
_.$nextArrow.remove();
|
851
|
+
}
|
832
852
|
}
|
833
853
|
|
834
854
|
if (_.$slides) {
|
835
855
|
|
836
856
|
_.$slides
|
837
|
-
.removeClass('slick-slide slick-active slick-center slick-visible')
|
857
|
+
.removeClass('slick-slide slick-active slick-center slick-visible slick-current')
|
838
858
|
.removeAttr('aria-hidden')
|
839
859
|
.removeAttr('data-slick-index')
|
840
860
|
.each(function(){
|
@@ -885,7 +905,7 @@
|
|
885
905
|
if (_.cssTransitions === false) {
|
886
906
|
|
887
907
|
_.$slides.eq(slideIndex).css({
|
888
|
-
zIndex:
|
908
|
+
zIndex: _.options.zIndex
|
889
909
|
});
|
890
910
|
|
891
911
|
_.$slides.eq(slideIndex).animate({
|
@@ -898,7 +918,7 @@
|
|
898
918
|
|
899
919
|
_.$slides.eq(slideIndex).css({
|
900
920
|
opacity: 1,
|
901
|
-
zIndex:
|
921
|
+
zIndex: _.options.zIndex
|
902
922
|
});
|
903
923
|
|
904
924
|
if (callback) {
|
@@ -914,6 +934,30 @@
|
|
914
934
|
|
915
935
|
};
|
916
936
|
|
937
|
+
Slick.prototype.fadeSlideOut = function(slideIndex) {
|
938
|
+
|
939
|
+
var _ = this;
|
940
|
+
|
941
|
+
if (_.cssTransitions === false) {
|
942
|
+
|
943
|
+
_.$slides.eq(slideIndex).animate({
|
944
|
+
opacity: 0,
|
945
|
+
zIndex: _.options.zIndex - 2
|
946
|
+
}, _.options.speed, _.options.easing);
|
947
|
+
|
948
|
+
} else {
|
949
|
+
|
950
|
+
_.applyTransition(slideIndex);
|
951
|
+
|
952
|
+
_.$slides.eq(slideIndex).css({
|
953
|
+
opacity: 0,
|
954
|
+
zIndex: _.options.zIndex - 2
|
955
|
+
});
|
956
|
+
|
957
|
+
}
|
958
|
+
|
959
|
+
};
|
960
|
+
|
917
961
|
Slick.prototype.filterSlides = Slick.prototype.slickFilter = function(filter) {
|
918
962
|
|
919
963
|
var _ = this;
|
@@ -976,7 +1020,7 @@
|
|
976
1020
|
targetSlide;
|
977
1021
|
|
978
1022
|
_.slideOffset = 0;
|
979
|
-
verticalHeight = _.$slides.first().outerHeight();
|
1023
|
+
verticalHeight = _.$slides.first().outerHeight(true);
|
980
1024
|
|
981
1025
|
if (_.options.infinite === true) {
|
982
1026
|
if (_.slideCount > _.options.slidesToShow) {
|
@@ -1129,6 +1173,7 @@
|
|
1129
1173
|
if (!$(_.$slider).hasClass('slick-initialized')) {
|
1130
1174
|
|
1131
1175
|
$(_.$slider).addClass('slick-initialized');
|
1176
|
+
|
1132
1177
|
_.buildRows();
|
1133
1178
|
_.buildOut();
|
1134
1179
|
_.setProps();
|
@@ -1137,12 +1182,17 @@
|
|
1137
1182
|
_.initializeEvents();
|
1138
1183
|
_.updateArrows();
|
1139
1184
|
_.updateDots();
|
1185
|
+
|
1140
1186
|
}
|
1141
1187
|
|
1142
1188
|
if (creation) {
|
1143
1189
|
_.$slider.trigger('init', [_]);
|
1144
1190
|
}
|
1145
1191
|
|
1192
|
+
if (_.options.accessibility === true) {
|
1193
|
+
_.initADA();
|
1194
|
+
}
|
1195
|
+
|
1146
1196
|
};
|
1147
1197
|
|
1148
1198
|
Slick.prototype.initArrowEvents = function() {
|
@@ -1253,19 +1303,21 @@
|
|
1253
1303
|
Slick.prototype.keyHandler = function(event) {
|
1254
1304
|
|
1255
1305
|
var _ = this;
|
1256
|
-
|
1257
|
-
if
|
1258
|
-
_.
|
1259
|
-
|
1260
|
-
|
1261
|
-
|
1262
|
-
|
1263
|
-
|
1264
|
-
_.
|
1265
|
-
|
1266
|
-
|
1267
|
-
|
1268
|
-
|
1306
|
+
//Dont slide if the cursor is inside the form fields and arrow keys are pressed
|
1307
|
+
if(!event.target.tagName.match('TEXTAREA|INPUT|SELECT')) {
|
1308
|
+
if (event.keyCode === 37 && _.options.accessibility === true) {
|
1309
|
+
_.changeSlide({
|
1310
|
+
data: {
|
1311
|
+
message: 'previous'
|
1312
|
+
}
|
1313
|
+
});
|
1314
|
+
} else if (event.keyCode === 39 && _.options.accessibility === true) {
|
1315
|
+
_.changeSlide({
|
1316
|
+
data: {
|
1317
|
+
message: 'next'
|
1318
|
+
}
|
1319
|
+
});
|
1320
|
+
}
|
1269
1321
|
}
|
1270
1322
|
|
1271
1323
|
};
|
@@ -1277,24 +1329,26 @@
|
|
1277
1329
|
|
1278
1330
|
function loadImages(imagesScope) {
|
1279
1331
|
$('img[data-lazy]', imagesScope).each(function() {
|
1332
|
+
|
1280
1333
|
var image = $(this),
|
1281
1334
|
imageSource = $(this).attr('data-lazy'),
|
1282
1335
|
imageToLoad = document.createElement('img');
|
1283
1336
|
|
1284
1337
|
imageToLoad.onload = function() {
|
1285
|
-
image
|
1286
|
-
|
1287
|
-
|
1338
|
+
image
|
1339
|
+
.animate({ opacity: 0 }, 100, function() {
|
1340
|
+
image
|
1341
|
+
.attr('src', imageSource)
|
1342
|
+
.animate({ opacity: 1 }, 200, function() {
|
1343
|
+
image
|
1344
|
+
.removeAttr('data-lazy')
|
1345
|
+
.removeClass('slick-loading');
|
1346
|
+
});
|
1347
|
+
});
|
1288
1348
|
};
|
1349
|
+
|
1289
1350
|
imageToLoad.src = imageSource;
|
1290
1351
|
|
1291
|
-
image
|
1292
|
-
.css({
|
1293
|
-
opacity: 0
|
1294
|
-
})
|
1295
|
-
.attr('src', imageSource)
|
1296
|
-
.removeAttr('data-lazy')
|
1297
|
-
.removeClass('slick-loading');
|
1298
1352
|
});
|
1299
1353
|
}
|
1300
1354
|
|
@@ -1406,6 +1460,9 @@
|
|
1406
1460
|
if (_.options.autoplay === true && _.paused === false) {
|
1407
1461
|
_.autoPlay();
|
1408
1462
|
}
|
1463
|
+
if (_.options.accessibility === true) {
|
1464
|
+
_.initADA();
|
1465
|
+
}
|
1409
1466
|
|
1410
1467
|
};
|
1411
1468
|
|
@@ -1457,7 +1514,7 @@
|
|
1457
1514
|
|
1458
1515
|
_.destroy(true);
|
1459
1516
|
|
1460
|
-
$.extend(_, _.initials);
|
1517
|
+
$.extend(_, _.initials, { currentSlide: currentSlide });
|
1461
1518
|
|
1462
1519
|
_.init();
|
1463
1520
|
|
@@ -1474,12 +1531,54 @@
|
|
1474
1531
|
|
1475
1532
|
};
|
1476
1533
|
|
1534
|
+
Slick.prototype.registerBreakpoints = function() {
|
1535
|
+
|
1536
|
+
var _ = this, breakpoint, currentBreakpoint, l,
|
1537
|
+
responsiveSettings = _.options.responsive || null;
|
1538
|
+
|
1539
|
+
if ( $.type(responsiveSettings) === "array" && responsiveSettings.length ) {
|
1540
|
+
|
1541
|
+
_.respondTo = _.options.respondTo || 'window';
|
1542
|
+
|
1543
|
+
for ( breakpoint in responsiveSettings ) {
|
1544
|
+
|
1545
|
+
l = _.breakpoints.length-1;
|
1546
|
+
currentBreakpoint = responsiveSettings[breakpoint].breakpoint;
|
1547
|
+
|
1548
|
+
if (responsiveSettings.hasOwnProperty(breakpoint)) {
|
1549
|
+
|
1550
|
+
// loop through the breakpoints and cut out any existing
|
1551
|
+
// ones with the same breakpoint number, we don't want dupes.
|
1552
|
+
while( l >= 0 ) {
|
1553
|
+
if( _.breakpoints[l] && _.breakpoints[l] === currentBreakpoint ) {
|
1554
|
+
_.breakpoints.splice(l,1);
|
1555
|
+
}
|
1556
|
+
l--;
|
1557
|
+
}
|
1558
|
+
|
1559
|
+
_.breakpoints.push(currentBreakpoint);
|
1560
|
+
_.breakpointSettings[currentBreakpoint] = responsiveSettings[breakpoint].settings;
|
1561
|
+
|
1562
|
+
}
|
1563
|
+
|
1564
|
+
}
|
1565
|
+
|
1566
|
+
_.breakpoints.sort(function(a, b) {
|
1567
|
+
return ( _.options.mobileFirst ) ? a-b : b-a;
|
1568
|
+
});
|
1569
|
+
|
1570
|
+
}
|
1571
|
+
|
1572
|
+
};
|
1573
|
+
|
1477
1574
|
Slick.prototype.reinit = function() {
|
1478
1575
|
|
1479
1576
|
var _ = this;
|
1480
1577
|
|
1481
|
-
_.$slides =
|
1482
|
-
|
1578
|
+
_.$slides =
|
1579
|
+
_.$slideTrack
|
1580
|
+
.children(_.options.slide)
|
1581
|
+
.addClass('slick-slide');
|
1483
1582
|
|
1484
1583
|
_.slideCount = _.$slides.length;
|
1485
1584
|
|
@@ -1491,22 +1590,19 @@
|
|
1491
1590
|
_.currentSlide = 0;
|
1492
1591
|
}
|
1493
1592
|
|
1494
|
-
_.
|
1593
|
+
_.registerBreakpoints();
|
1495
1594
|
|
1595
|
+
_.setProps();
|
1496
1596
|
_.setupInfinite();
|
1497
|
-
|
1498
1597
|
_.buildArrows();
|
1499
|
-
|
1500
1598
|
_.updateArrows();
|
1501
|
-
|
1502
1599
|
_.initArrowEvents();
|
1503
|
-
|
1504
1600
|
_.buildDots();
|
1505
|
-
|
1506
1601
|
_.updateDots();
|
1507
|
-
|
1508
1602
|
_.initDotEvents();
|
1509
1603
|
|
1604
|
+
_.checkResponsive(false, true);
|
1605
|
+
|
1510
1606
|
if (_.options.focusOnSelect === true) {
|
1511
1607
|
$(_.$slideTrack).children().on('click.slick', _.selectHandler);
|
1512
1608
|
}
|
@@ -1517,6 +1613,10 @@
|
|
1517
1613
|
|
1518
1614
|
_.$slider.trigger('reInit', [_]);
|
1519
1615
|
|
1616
|
+
if (_.options.autoplay === true) {
|
1617
|
+
_.focusHandler();
|
1618
|
+
}
|
1619
|
+
|
1520
1620
|
};
|
1521
1621
|
|
1522
1622
|
Slick.prototype.resize = function() {
|
@@ -1648,7 +1748,7 @@
|
|
1648
1748
|
position: 'relative',
|
1649
1749
|
right: targetLeft,
|
1650
1750
|
top: 0,
|
1651
|
-
zIndex:
|
1751
|
+
zIndex: _.options.zIndex - 2,
|
1652
1752
|
opacity: 0
|
1653
1753
|
});
|
1654
1754
|
} else {
|
@@ -1656,14 +1756,14 @@
|
|
1656
1756
|
position: 'relative',
|
1657
1757
|
left: targetLeft,
|
1658
1758
|
top: 0,
|
1659
|
-
zIndex:
|
1759
|
+
zIndex: _.options.zIndex - 2,
|
1660
1760
|
opacity: 0
|
1661
1761
|
});
|
1662
1762
|
}
|
1663
1763
|
});
|
1664
1764
|
|
1665
1765
|
_.$slides.eq(_.currentSlide).css({
|
1666
|
-
zIndex:
|
1766
|
+
zIndex: _.options.zIndex - 1,
|
1667
1767
|
opacity: 1
|
1668
1768
|
});
|
1669
1769
|
|
@@ -1682,8 +1782,27 @@
|
|
1682
1782
|
|
1683
1783
|
Slick.prototype.setOption = Slick.prototype.slickSetOption = function(option, value, refresh) {
|
1684
1784
|
|
1685
|
-
var _ = this;
|
1686
|
-
|
1785
|
+
var _ = this, l, item;
|
1786
|
+
|
1787
|
+
if( option === "responsive" && $.type(value) === "array" ) {
|
1788
|
+
for ( item in value ) {
|
1789
|
+
if( $.type( _.options.responsive ) !== "array" ) {
|
1790
|
+
_.options.responsive = [ value[item] ];
|
1791
|
+
} else {
|
1792
|
+
l = _.options.responsive.length-1;
|
1793
|
+
// loop through the responsive object and splice out duplicates.
|
1794
|
+
while( l >= 0 ) {
|
1795
|
+
if( _.options.responsive[l].breakpoint === value[item].breakpoint ) {
|
1796
|
+
_.options.responsive.splice(l,1);
|
1797
|
+
}
|
1798
|
+
l--;
|
1799
|
+
}
|
1800
|
+
_.options.responsive.push( value[item] );
|
1801
|
+
}
|
1802
|
+
}
|
1803
|
+
} else {
|
1804
|
+
_.options[option] = value;
|
1805
|
+
}
|
1687
1806
|
|
1688
1807
|
if (refresh === true) {
|
1689
1808
|
_.unload();
|
@@ -1731,6 +1850,16 @@
|
|
1731
1850
|
}
|
1732
1851
|
}
|
1733
1852
|
|
1853
|
+
if ( _.options.fade ) {
|
1854
|
+
if ( typeof _.options.zIndex === 'number' ) {
|
1855
|
+
if( _.options.zIndex < 3 ) {
|
1856
|
+
_.options.zIndex = 3;
|
1857
|
+
}
|
1858
|
+
} else {
|
1859
|
+
_.options.zIndex = _.defaults.zIndex;
|
1860
|
+
}
|
1861
|
+
}
|
1862
|
+
|
1734
1863
|
if (bodyStyle.OTransform !== undefined) {
|
1735
1864
|
_.animType = 'OTransform';
|
1736
1865
|
_.transformType = '-o-transform';
|
@@ -1770,8 +1899,14 @@
|
|
1770
1899
|
var _ = this,
|
1771
1900
|
centerOffset, allSlides, indexOffset, remainder;
|
1772
1901
|
|
1773
|
-
_.$slider
|
1774
|
-
|
1902
|
+
allSlides = _.$slider
|
1903
|
+
.find('.slick-slide')
|
1904
|
+
.removeClass('slick-active slick-center slick-current')
|
1905
|
+
.attr('aria-hidden', 'true');
|
1906
|
+
|
1907
|
+
_.$slides
|
1908
|
+
.eq(index)
|
1909
|
+
.addClass('slick-current');
|
1775
1910
|
|
1776
1911
|
if (_.options.centerMode === true) {
|
1777
1912
|
|
@@ -1780,36 +1915,78 @@
|
|
1780
1915
|
if (_.options.infinite === true) {
|
1781
1916
|
|
1782
1917
|
if (index >= centerOffset && index <= (_.slideCount - 1) - centerOffset) {
|
1783
|
-
|
1918
|
+
|
1919
|
+
_.$slides
|
1920
|
+
.slice(index - centerOffset, index + centerOffset + 1)
|
1921
|
+
.addClass('slick-active')
|
1922
|
+
.attr('aria-hidden', 'false');
|
1923
|
+
|
1784
1924
|
} else {
|
1925
|
+
|
1785
1926
|
indexOffset = _.options.slidesToShow + index;
|
1786
|
-
allSlides
|
1927
|
+
allSlides
|
1928
|
+
.slice(indexOffset - centerOffset + 1, indexOffset + centerOffset + 2)
|
1929
|
+
.addClass('slick-active')
|
1930
|
+
.attr('aria-hidden', 'false');
|
1931
|
+
|
1787
1932
|
}
|
1788
1933
|
|
1789
1934
|
if (index === 0) {
|
1790
|
-
|
1935
|
+
|
1936
|
+
allSlides
|
1937
|
+
.eq(allSlides.length - 1 - _.options.slidesToShow)
|
1938
|
+
.addClass('slick-center');
|
1939
|
+
|
1791
1940
|
} else if (index === _.slideCount - 1) {
|
1792
|
-
|
1941
|
+
|
1942
|
+
allSlides
|
1943
|
+
.eq(_.options.slidesToShow)
|
1944
|
+
.addClass('slick-center');
|
1945
|
+
|
1793
1946
|
}
|
1794
1947
|
|
1795
1948
|
}
|
1796
1949
|
|
1797
|
-
_.$slides
|
1950
|
+
_.$slides
|
1951
|
+
.eq(index)
|
1952
|
+
.addClass('slick-center');
|
1798
1953
|
|
1799
1954
|
} else {
|
1800
1955
|
|
1801
1956
|
if (index >= 0 && index <= (_.slideCount - _.options.slidesToShow)) {
|
1802
|
-
|
1957
|
+
|
1958
|
+
_.$slides
|
1959
|
+
.slice(index, index + _.options.slidesToShow)
|
1960
|
+
.addClass('slick-active')
|
1961
|
+
.attr('aria-hidden', 'false');
|
1962
|
+
|
1803
1963
|
} else if (allSlides.length <= _.options.slidesToShow) {
|
1804
|
-
|
1964
|
+
|
1965
|
+
allSlides
|
1966
|
+
.addClass('slick-active')
|
1967
|
+
.attr('aria-hidden', 'false');
|
1968
|
+
|
1805
1969
|
} else {
|
1970
|
+
|
1806
1971
|
remainder = _.slideCount % _.options.slidesToShow;
|
1807
1972
|
indexOffset = _.options.infinite === true ? _.options.slidesToShow + index : index;
|
1973
|
+
|
1808
1974
|
if (_.options.slidesToShow == _.options.slidesToScroll && (_.slideCount - index) < _.options.slidesToShow) {
|
1809
|
-
|
1975
|
+
|
1976
|
+
allSlides
|
1977
|
+
.slice(indexOffset - (_.options.slidesToShow - remainder), indexOffset + remainder)
|
1978
|
+
.addClass('slick-active')
|
1979
|
+
.attr('aria-hidden', 'false');
|
1980
|
+
|
1810
1981
|
} else {
|
1811
|
-
|
1982
|
+
|
1983
|
+
allSlides
|
1984
|
+
.slice(indexOffset, indexOffset + _.options.slidesToShow)
|
1985
|
+
.addClass('slick-active')
|
1986
|
+
.attr('aria-hidden', 'false');
|
1987
|
+
|
1812
1988
|
}
|
1989
|
+
|
1813
1990
|
}
|
1814
1991
|
|
1815
1992
|
}
|
@@ -1882,24 +2059,23 @@
|
|
1882
2059
|
|
1883
2060
|
var _ = this;
|
1884
2061
|
|
1885
|
-
var targetElement =
|
1886
|
-
$(event.target)
|
1887
|
-
|
2062
|
+
var targetElement =
|
2063
|
+
$(event.target).is('.slick-slide') ?
|
2064
|
+
$(event.target) :
|
2065
|
+
$(event.target).parents('.slick-slide');
|
1888
2066
|
|
1889
2067
|
var index = parseInt(targetElement.attr('data-slick-index'));
|
1890
2068
|
|
1891
2069
|
if (!index) index = 0;
|
1892
2070
|
|
1893
2071
|
if (_.slideCount <= _.options.slidesToShow) {
|
1894
|
-
|
1895
|
-
_
|
1896
|
-
if (_.options.centerMode === true) {
|
1897
|
-
_.$slider.find('.slick-slide').removeClass('slick-center');
|
1898
|
-
_.$slides.eq(index).addClass('slick-center');
|
1899
|
-
}
|
2072
|
+
|
2073
|
+
_.setSlideClasses(index);
|
1900
2074
|
_.asNavFor(index);
|
1901
2075
|
return;
|
2076
|
+
|
1902
2077
|
}
|
2078
|
+
|
1903
2079
|
_.slideHandler(index);
|
1904
2080
|
|
1905
2081
|
};
|
@@ -1981,7 +2157,7 @@
|
|
1981
2157
|
|
1982
2158
|
_.animating = true;
|
1983
2159
|
|
1984
|
-
_.$slider.trigger(
|
2160
|
+
_.$slider.trigger('beforeChange', [_, _.currentSlide, animSlide]);
|
1985
2161
|
|
1986
2162
|
oldSlide = _.currentSlide;
|
1987
2163
|
_.currentSlide = animSlide;
|
@@ -1993,9 +2169,13 @@
|
|
1993
2169
|
|
1994
2170
|
if (_.options.fade === true) {
|
1995
2171
|
if (dontAnimate !== true) {
|
2172
|
+
|
2173
|
+
_.fadeSlideOut(oldSlide);
|
2174
|
+
|
1996
2175
|
_.fadeSlide(animSlide, function() {
|
1997
2176
|
_.postSlide(animSlide);
|
1998
2177
|
});
|
2178
|
+
|
1999
2179
|
} else {
|
2000
2180
|
_.postSlide(animSlide);
|
2001
2181
|
}
|
@@ -2082,7 +2262,7 @@
|
|
2082
2262
|
}
|
2083
2263
|
|
2084
2264
|
if (_.touchObject.edgeHit === true) {
|
2085
|
-
_.$slider.trigger(
|
2265
|
+
_.$slider.trigger('edge', [_, _.swipeDirection()]);
|
2086
2266
|
}
|
2087
2267
|
|
2088
2268
|
if (_.touchObject.swipeLength >= _.touchObject.minSwipe) {
|
@@ -2093,7 +2273,7 @@
|
|
2093
2273
|
_.slideHandler(slideCount);
|
2094
2274
|
_.currentDirection = 0;
|
2095
2275
|
_.touchObject = {};
|
2096
|
-
_.$slider.trigger(
|
2276
|
+
_.$slider.trigger('swipe', [_, 'left']);
|
2097
2277
|
break;
|
2098
2278
|
|
2099
2279
|
case 'right':
|
@@ -2101,7 +2281,7 @@
|
|
2101
2281
|
_.slideHandler(slideCount);
|
2102
2282
|
_.currentDirection = 1;
|
2103
2283
|
_.touchObject = {};
|
2104
|
-
_.$slider.trigger(
|
2284
|
+
_.$slider.trigger('swipe', [_, 'right']);
|
2105
2285
|
break;
|
2106
2286
|
}
|
2107
2287
|
} else {
|
@@ -2198,7 +2378,7 @@
|
|
2198
2378
|
_.touchObject.edgeHit = false;
|
2199
2379
|
|
2200
2380
|
if (_.options.infinite === false) {
|
2201
|
-
if ((_.currentSlide === 0 && swipeDirection ===
|
2381
|
+
if ((_.currentSlide === 0 && swipeDirection === 'right') || (_.currentSlide >= _.getDotCount() && swipeDirection === 'left')) {
|
2202
2382
|
swipeLength = _.touchObject.swipeLength * _.options.edgeFriction;
|
2203
2383
|
_.touchObject.edgeHit = true;
|
2204
2384
|
}
|
@@ -2270,16 +2450,23 @@
|
|
2270
2450
|
var _ = this;
|
2271
2451
|
|
2272
2452
|
$('.slick-cloned', _.$slider).remove();
|
2453
|
+
|
2273
2454
|
if (_.$dots) {
|
2274
2455
|
_.$dots.remove();
|
2275
2456
|
}
|
2276
|
-
|
2457
|
+
|
2458
|
+
if (_.$prevArrow && _.htmlExpr.test(_.options.prevArrow)) {
|
2277
2459
|
_.$prevArrow.remove();
|
2278
2460
|
}
|
2279
|
-
|
2461
|
+
|
2462
|
+
if (_.$nextArrow && _.htmlExpr.test(_.options.nextArrow)) {
|
2280
2463
|
_.$nextArrow.remove();
|
2281
2464
|
}
|
2282
|
-
|
2465
|
+
|
2466
|
+
_.$slides
|
2467
|
+
.removeClass('slick-slide slick-active slick-visible slick-current')
|
2468
|
+
.attr('aria-hidden', 'true')
|
2469
|
+
.css('width', '');
|
2283
2470
|
|
2284
2471
|
};
|
2285
2472
|
|
@@ -2298,20 +2485,30 @@
|
|
2298
2485
|
|
2299
2486
|
centerOffset = Math.floor(_.options.slidesToShow / 2);
|
2300
2487
|
|
2301
|
-
if (_.options.arrows === true &&
|
2302
|
-
|
2303
|
-
|
2304
|
-
|
2488
|
+
if ( _.options.arrows === true &&
|
2489
|
+
_.slideCount > _.options.slidesToShow &&
|
2490
|
+
!_.options.infinite ) {
|
2491
|
+
|
2492
|
+
_.$prevArrow.removeClass('slick-disabled').attr('aria-disabled', 'false');
|
2493
|
+
_.$nextArrow.removeClass('slick-disabled').attr('aria-disabled', 'false');
|
2494
|
+
|
2305
2495
|
if (_.currentSlide === 0) {
|
2306
|
-
|
2307
|
-
_.$
|
2496
|
+
|
2497
|
+
_.$prevArrow.addClass('slick-disabled').attr('aria-disabled', 'true');
|
2498
|
+
_.$nextArrow.removeClass('slick-disabled').attr('aria-disabled', 'false');
|
2499
|
+
|
2308
2500
|
} else if (_.currentSlide >= _.slideCount - _.options.slidesToShow && _.options.centerMode === false) {
|
2309
|
-
|
2310
|
-
_.$
|
2501
|
+
|
2502
|
+
_.$nextArrow.addClass('slick-disabled').attr('aria-disabled', 'true');
|
2503
|
+
_.$prevArrow.removeClass('slick-disabled').attr('aria-disabled', 'false');
|
2504
|
+
|
2311
2505
|
} else if (_.currentSlide >= _.slideCount - 1 && _.options.centerMode === true) {
|
2312
|
-
|
2313
|
-
_.$
|
2506
|
+
|
2507
|
+
_.$nextArrow.addClass('slick-disabled').attr('aria-disabled', 'true');
|
2508
|
+
_.$prevArrow.removeClass('slick-disabled').attr('aria-disabled', 'false');
|
2509
|
+
|
2314
2510
|
}
|
2511
|
+
|
2315
2512
|
}
|
2316
2513
|
|
2317
2514
|
};
|
@@ -2322,8 +2519,16 @@
|
|
2322
2519
|
|
2323
2520
|
if (_.$dots !== null) {
|
2324
2521
|
|
2325
|
-
_.$dots
|
2326
|
-
|
2522
|
+
_.$dots
|
2523
|
+
.find('li')
|
2524
|
+
.removeClass('slick-active')
|
2525
|
+
.attr('aria-hidden', 'true');
|
2526
|
+
|
2527
|
+
_.$dots
|
2528
|
+
.find('li')
|
2529
|
+
.eq(Math.floor(_.currentSlide / _.options.slidesToScroll))
|
2530
|
+
.addClass('slick-active')
|
2531
|
+
.attr('aria-hidden', 'false');
|
2327
2532
|
|
2328
2533
|
}
|
2329
2534
|
|
@@ -2344,6 +2549,75 @@
|
|
2344
2549
|
}
|
2345
2550
|
|
2346
2551
|
};
|
2552
|
+
Slick.prototype.initADA = function() {
|
2553
|
+
var _ = this;
|
2554
|
+
_.$slides.add(_.$slideTrack.find('.slick-cloned')).attr({
|
2555
|
+
'aria-hidden': 'true',
|
2556
|
+
'tabindex': '-1'
|
2557
|
+
}).find('a, input, button, select').attr({
|
2558
|
+
'tabindex': '-1'
|
2559
|
+
});
|
2560
|
+
|
2561
|
+
_.$slideTrack.attr('role', 'listbox');
|
2562
|
+
|
2563
|
+
_.$slides.not(_.$slideTrack.find('.slick-cloned')).each(function(i) {
|
2564
|
+
$(this).attr({
|
2565
|
+
'role': 'option',
|
2566
|
+
'aria-describedby': 'slick-slide' + _.instanceUid + i + ''
|
2567
|
+
});
|
2568
|
+
});
|
2569
|
+
|
2570
|
+
if (_.$dots !== null) {
|
2571
|
+
_.$dots.attr('role', 'tablist').find('li').each(function(i) {
|
2572
|
+
$(this).attr({
|
2573
|
+
'role': 'presentation',
|
2574
|
+
'aria-selected': 'false',
|
2575
|
+
'aria-controls': 'navigation' + _.instanceUid + i + '',
|
2576
|
+
'id': 'slick-slide' + _.instanceUid + i + ''
|
2577
|
+
});
|
2578
|
+
})
|
2579
|
+
.first().attr('aria-selected', 'true').end()
|
2580
|
+
.find('button').attr('role', 'button').end()
|
2581
|
+
.closest('div').attr('role', 'toolbar');
|
2582
|
+
}
|
2583
|
+
_.activateADA();
|
2584
|
+
|
2585
|
+
};
|
2586
|
+
|
2587
|
+
Slick.prototype.activateADA = function() {
|
2588
|
+
var _ = this,
|
2589
|
+
_isSlideOnFocus =_.$slider.find('*').is(':focus');
|
2590
|
+
// _isSlideOnFocus = _.$slides.is(':focus') || _.$slides.find('*').is(':focus');
|
2591
|
+
|
2592
|
+
_.$slideTrack.find('.slick-active').attr({
|
2593
|
+
'aria-hidden': 'false',
|
2594
|
+
'tabindex': '0'
|
2595
|
+
}).find('a, input, button, select').attr({
|
2596
|
+
'tabindex': '0'
|
2597
|
+
});
|
2598
|
+
|
2599
|
+
(_isSlideOnFocus) && _.$slideTrack.find('.slick-active').focus();
|
2600
|
+
|
2601
|
+
};
|
2602
|
+
|
2603
|
+
Slick.prototype.focusHandler = function() {
|
2604
|
+
var _ = this;
|
2605
|
+
_.$slider.on('focus.slick blur.slick', '*', function(event) {
|
2606
|
+
event.stopImmediatePropagation();
|
2607
|
+
var sf = $(this);
|
2608
|
+
setTimeout(function() {
|
2609
|
+
if (_.isPlay) {
|
2610
|
+
if (sf.is(':focus')) {
|
2611
|
+
_.autoPlayClear();
|
2612
|
+
_.paused = true;
|
2613
|
+
} else {
|
2614
|
+
_.paused = false;
|
2615
|
+
_.autoPlay();
|
2616
|
+
}
|
2617
|
+
}
|
2618
|
+
}, 0);
|
2619
|
+
});
|
2620
|
+
};
|
2347
2621
|
|
2348
2622
|
$.fn.slick = function() {
|
2349
2623
|
var _ = this,
|
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.5.
|
4
|
+
version: 1.5.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ilya Bodrov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-07-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: railties
|
@@ -64,8 +64,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
64
64
|
version: '0'
|
65
65
|
requirements: []
|
66
66
|
rubyforge_project:
|
67
|
-
rubygems_version: 2.4.
|
67
|
+
rubygems_version: 2.4.7
|
68
68
|
signing_key:
|
69
69
|
specification_version: 4
|
70
70
|
summary: Integrates Slick carousel into Rails app.
|
71
71
|
test_files: []
|
72
|
+
has_rdoc:
|