slick_rails 1.3.7 → 1.3.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/app/assets/javascripts/slick.js +147 -67
- 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: 857728d83e274c812437e470a0bdeb5012100cb4
|
4
|
+
data.tar.gz: ef94d7cbc618a8071074bd9e8892a161a3d3315e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 74488bb2507f41ddcc1a4017ac4a3f5e7ba52a2e64d279cc02ac8944eb4c64e01e3fd381de109af9f751932bd3641d27f1045391333a8513a723284638e63d7c
|
7
|
+
data.tar.gz: b5080b9daa7639a003249ad35fc04ddce056950bebbe84d5a30da12d25e24140c183974f3800f09464ef8ef26f6cea7b98b2a328f5dd53cd0aed98c824103da4
|
data/README.md
CHANGED
@@ -42,7 +42,7 @@ see instruction and full info in https://github.com/kenwheeler/slick
|
|
42
42
|
|
43
43
|
## Contributing
|
44
44
|
|
45
|
-
1. Fork it ( http://github.com
|
45
|
+
1. Fork it ( http://github.com/guyisra/slick_rails/fork )
|
46
46
|
2. Create your feature branch (`git checkout -b my-new-feature`)
|
47
47
|
3. Commit your changes (`git commit -am 'Add some feature'`)
|
48
48
|
4. Push to the branch (`git push origin my-new-feature`)
|
@@ -6,7 +6,7 @@
|
|
6
6
|
|___/_|_|\___|_|\_(_)/ |___/
|
7
7
|
|__/
|
8
8
|
|
9
|
-
Version: 1.3.
|
9
|
+
Version: 1.3.8
|
10
10
|
Author: Ken Wheeler
|
11
11
|
Website: http://kenwheeler.github.io
|
12
12
|
Docs: http://kenwheeler.github.io/slick
|
@@ -21,6 +21,8 @@
|
|
21
21
|
'use strict';
|
22
22
|
if (typeof define === 'function' && define.amd) {
|
23
23
|
define(['jquery'], factory);
|
24
|
+
} else if (typeof exports !== 'undefined') {
|
25
|
+
module.exports = factory(require('jquery'));
|
24
26
|
} else {
|
25
27
|
factory(jQuery);
|
26
28
|
}
|
@@ -40,7 +42,9 @@
|
|
40
42
|
|
41
43
|
_.defaults = {
|
42
44
|
accessibility: true,
|
45
|
+
adaptiveHeight: false,
|
43
46
|
appendArrows: $(element),
|
47
|
+
appendDots: $(element),
|
44
48
|
arrows: true,
|
45
49
|
asNavFor: null,
|
46
50
|
prevArrow: '<button type="button" data-role="none" class="slick-prev">Previous</button>',
|
@@ -74,10 +78,13 @@
|
|
74
78
|
slidesToScroll: 1,
|
75
79
|
speed: 300,
|
76
80
|
swipe: true,
|
81
|
+
swipeToSlide: false,
|
77
82
|
touchMove: true,
|
78
83
|
touchThreshold: 5,
|
79
84
|
useCSS: true,
|
80
|
-
|
85
|
+
variableWidth: false,
|
86
|
+
vertical: false,
|
87
|
+
waitForAnimate: true
|
81
88
|
};
|
82
89
|
|
83
90
|
_.initials = {
|
@@ -216,6 +223,11 @@
|
|
216
223
|
|
217
224
|
var animProps = {}, _ = this;
|
218
225
|
|
226
|
+
if(_.options.slidesToShow === 1 && _.options.adaptiveHeight === true && _.options.vertical === false) {
|
227
|
+
var targetHeight = _.$slides.eq(_.currentSlide).outerHeight(true);
|
228
|
+
_.$list.animate({height: targetHeight},_.options.speed);
|
229
|
+
}
|
230
|
+
|
219
231
|
if (_.options.rtl === true && _.options.vertical === false) {
|
220
232
|
targetLeft = -targetLeft;
|
221
233
|
}
|
@@ -285,6 +297,11 @@
|
|
285
297
|
|
286
298
|
};
|
287
299
|
|
300
|
+
Slick.prototype.asNavFor = function(index) {
|
301
|
+
var _ = this, asNavFor = _.options.asNavFor != null ? $(_.options.asNavFor).getSlick() : null;
|
302
|
+
if(asNavFor != null) asNavFor.slideHandler(index, true);
|
303
|
+
};
|
304
|
+
|
288
305
|
Slick.prototype.applyTransition = function(slide) {
|
289
306
|
|
290
307
|
var _ = this,
|
@@ -332,7 +349,6 @@
|
|
332
349
|
Slick.prototype.autoPlayIterator = function() {
|
333
350
|
|
334
351
|
var _ = this;
|
335
|
-
var asNavFor = _.options.asNavFor != null ? $(_.options.asNavFor).getSlick() : null;
|
336
352
|
|
337
353
|
if (_.options.infinite === false) {
|
338
354
|
|
@@ -344,7 +360,6 @@
|
|
344
360
|
}
|
345
361
|
|
346
362
|
_.slideHandler(_.currentSlide + _.options.slidesToScroll);
|
347
|
-
if(asNavFor != null) asNavFor.slideHandler(asNavFor.currentSlide + asNavFor.options.slidesToScroll);
|
348
363
|
|
349
364
|
} else {
|
350
365
|
|
@@ -355,14 +370,12 @@
|
|
355
370
|
}
|
356
371
|
|
357
372
|
_.slideHandler(_.currentSlide - _.options.slidesToScroll);
|
358
|
-
if(asNavFor != null) asNavFor.slideHandler(asNavFor.currentSlide - asNavFor.options.slidesToScroll);
|
359
373
|
|
360
374
|
}
|
361
375
|
|
362
376
|
} else {
|
363
377
|
|
364
378
|
_.slideHandler(_.currentSlide + _.options.slidesToScroll);
|
365
|
-
if(asNavFor != null) asNavFor.slideHandler(asNavFor.currentSlide + asNavFor.options.slidesToScroll);
|
366
379
|
|
367
380
|
}
|
368
381
|
|
@@ -409,7 +422,7 @@
|
|
409
422
|
dotString += '</ul>';
|
410
423
|
|
411
424
|
_.$dots = $(dotString).appendTo(
|
412
|
-
_
|
425
|
+
_.options.appendDots);
|
413
426
|
|
414
427
|
_.$dots.find('li').first().addClass(
|
415
428
|
'slick-active');
|
@@ -525,34 +538,35 @@
|
|
525
538
|
Slick.prototype.changeSlide = function(event) {
|
526
539
|
|
527
540
|
var _ = this,
|
528
|
-
$target = $(event.target)
|
529
|
-
|
541
|
+
$target = $(event.target),
|
542
|
+
indexOffset, slideOffset, unevenOffset;
|
530
543
|
|
531
544
|
// If target is a link, prevent default action.
|
532
545
|
$target.is('a') && event.preventDefault();
|
533
546
|
|
547
|
+
unevenOffset = (_.slideCount % _.options.slidesToScroll !== 0);
|
548
|
+
indexOffset = unevenOffset ? 0 : (_.slideCount - _.currentSlide) % _.options.slidesToScroll;
|
549
|
+
|
534
550
|
switch (event.data.message) {
|
535
551
|
|
536
552
|
case 'previous':
|
553
|
+
slideOffset = indexOffset === 0 ? _.options.slidesToScroll : _.options.slidesToShow - indexOffset;
|
537
554
|
if (_.slideCount > _.options.slidesToShow) {
|
538
|
-
|
539
|
-
.slidesToScroll);
|
540
|
-
if(asNavFor != null) asNavFor.slideHandler(asNavFor.currentSlide - asNavFor.options.slidesToScroll);
|
555
|
+
_.slideHandler(_.currentSlide - slideOffset);
|
541
556
|
}
|
542
557
|
break;
|
543
558
|
|
544
559
|
case 'next':
|
560
|
+
slideOffset = indexOffset === 0 ? _.options.slidesToScroll : indexOffset;
|
545
561
|
if (_.slideCount > _.options.slidesToShow) {
|
546
|
-
|
547
|
-
.slidesToScroll);
|
548
|
-
if(asNavFor != null) asNavFor.slideHandler(asNavFor.currentSlide + asNavFor.options.slidesToScroll);
|
562
|
+
_.slideHandler(_.currentSlide + slideOffset);
|
549
563
|
}
|
550
564
|
break;
|
551
565
|
|
552
566
|
case 'index':
|
553
|
-
var index =
|
567
|
+
var index = event.data.index === 0 ? 0 :
|
568
|
+
event.data.index || $(event.target).parent().index() * _.options.slidesToScroll;
|
554
569
|
_.slideHandler(index);
|
555
|
-
if(asNavFor != null) asNavFor.slideHandler(index); break;
|
556
570
|
|
557
571
|
default:
|
558
572
|
return false;
|
@@ -580,7 +594,7 @@
|
|
580
594
|
_.$slides.unwrap().unwrap();
|
581
595
|
}
|
582
596
|
_.$slides.removeClass(
|
583
|
-
'slick-slide slick-active slick-visible').
|
597
|
+
'slick-slide slick-active slick-visible').css('width', '');
|
584
598
|
_.$slider.removeClass('slick-slider');
|
585
599
|
_.$slider.removeClass('slick-initialized');
|
586
600
|
|
@@ -692,7 +706,9 @@
|
|
692
706
|
var _ = this,
|
693
707
|
targetLeft,
|
694
708
|
verticalHeight,
|
695
|
-
verticalOffset = 0
|
709
|
+
verticalOffset = 0,
|
710
|
+
slideWidth,
|
711
|
+
targetSlide;
|
696
712
|
|
697
713
|
_.slideOffset = 0;
|
698
714
|
verticalHeight = _.$slides.first().outerHeight();
|
@@ -701,6 +717,9 @@
|
|
701
717
|
if (_.slideCount > _.options.slidesToShow) {
|
702
718
|
_.slideOffset = (_.slideWidth * _.options.slidesToShow) * -1;
|
703
719
|
verticalOffset = (verticalHeight * _.options.slidesToShow) * -1;
|
720
|
+
} else {
|
721
|
+
_.slideOffset = 0;
|
722
|
+
verticalOffset = 0;
|
704
723
|
}
|
705
724
|
if (_.slideCount % _.options.slidesToScroll !== 0) {
|
706
725
|
if (slideIndex + _.options.slidesToScroll > _.slideCount && _.slideCount > _.options.slidesToShow) {
|
@@ -729,6 +748,16 @@
|
|
729
748
|
targetLeft = ((slideIndex * verticalHeight) * -1) + verticalOffset;
|
730
749
|
}
|
731
750
|
|
751
|
+
if (_.options.variableWidth === true) {
|
752
|
+
targetSlide = _.$slideTrack.children('.slick-slide').eq(slideIndex + _.options.slidesToShow);
|
753
|
+
targetLeft = targetSlide[0].offsetLeft * -1;
|
754
|
+
if (_.options.centerMode === true) {
|
755
|
+
targetSlide = _.$slideTrack.children('.slick-slide').eq(slideIndex + _.options.slidesToShow + 1);
|
756
|
+
targetLeft = targetSlide[0].offsetLeft * -1;
|
757
|
+
targetLeft += (_.$list.width() - targetSlide.outerWidth()) / 2;
|
758
|
+
}
|
759
|
+
}
|
760
|
+
|
732
761
|
return targetLeft;
|
733
762
|
|
734
763
|
};
|
@@ -895,7 +924,7 @@
|
|
895
924
|
function loadImages(imagesScope) {
|
896
925
|
$('img[data-lazy]', imagesScope).each(function() {
|
897
926
|
var image = $(this),
|
898
|
-
imageSource = $(this).attr('data-lazy')
|
927
|
+
imageSource = $(this).attr('data-lazy');
|
899
928
|
|
900
929
|
image
|
901
930
|
.load(function() { image.animate({ opacity: 1 }, 200); })
|
@@ -906,18 +935,27 @@
|
|
906
935
|
});
|
907
936
|
}
|
908
937
|
|
909
|
-
if (_.options.centerMode === true
|
910
|
-
|
911
|
-
|
938
|
+
if (_.options.centerMode === true) {
|
939
|
+
if (_.options.infinite === true) {
|
940
|
+
rangeStart = _.currentSlide + (_.options.slidesToShow/2 + 1);
|
941
|
+
rangeEnd = rangeStart + _.options.slidesToShow + 2;
|
942
|
+
} else {
|
943
|
+
rangeStart = Math.max(0, _.currentSlide - (_.options.slidesToShow/2 + 1));
|
944
|
+
rangeEnd = 2 + (_.options.slidesToShow/2 + 1) + _.currentSlide;
|
945
|
+
}
|
912
946
|
} else {
|
913
947
|
rangeStart = _.options.infinite ? _.options.slidesToShow + _.currentSlide : _.currentSlide;
|
914
948
|
rangeEnd = rangeStart + _.options.slidesToShow;
|
949
|
+
if (_.options.fade === true ) {
|
950
|
+
if(rangeStart > 0) rangeStart--;
|
951
|
+
if(rangeEnd <= _.slideCount) rangeEnd++;
|
952
|
+
}
|
915
953
|
}
|
916
954
|
|
917
955
|
loadRange = _.$slider.find('.slick-slide').slice(rangeStart, rangeEnd);
|
918
956
|
loadImages(loadRange);
|
919
957
|
|
920
|
-
if (_.slideCount
|
958
|
+
if (_.slideCount <= _.options.slidesToShow){
|
921
959
|
cloneRange = _.$slider.find('.slick-slide')
|
922
960
|
loadImages(cloneRange)
|
923
961
|
}else
|
@@ -983,7 +1021,11 @@
|
|
983
1021
|
targetImage.attr('src', targetImage.attr('data-lazy')).removeClass('slick-loading').load(function() {
|
984
1022
|
targetImage.removeAttr('data-lazy');
|
985
1023
|
_.progressiveLazyLoad();
|
986
|
-
})
|
1024
|
+
})
|
1025
|
+
.error(function () {
|
1026
|
+
targetImage.removeAttr('data-lazy');
|
1027
|
+
_.progressiveLazyLoad();
|
1028
|
+
});
|
987
1029
|
}
|
988
1030
|
|
989
1031
|
};
|
@@ -1127,18 +1169,23 @@
|
|
1127
1169
|
_.listHeight = _.$list.height();
|
1128
1170
|
|
1129
1171
|
|
1130
|
-
if(_.options.vertical === false) {
|
1172
|
+
if(_.options.vertical === false && _.options.variableWidth === false) {
|
1131
1173
|
_.slideWidth = Math.ceil(_.listWidth / _.options.slidesToShow);
|
1132
1174
|
_.$slideTrack.width(Math.ceil((_.slideWidth * _.$slideTrack.children('.slick-slide').length)));
|
1133
1175
|
|
1176
|
+
} else if (_.options.variableWidth === true) {
|
1177
|
+
_.slideWidth = 0;
|
1178
|
+
_.$slideTrack.children('.slick-slide').each(function(){
|
1179
|
+
_.slideWidth += $(this).outerWidth();
|
1180
|
+
});
|
1181
|
+
_.$slideTrack.width(Math.ceil(_.slideWidth));
|
1134
1182
|
} else {
|
1135
1183
|
_.slideWidth = Math.ceil(_.listWidth);
|
1136
1184
|
_.$slideTrack.height(Math.ceil((_.$slides.first().outerHeight(true) * _.$slideTrack.children('.slick-slide').length)));
|
1137
|
-
|
1138
1185
|
}
|
1139
1186
|
|
1140
1187
|
var offset = _.$slides.first().outerWidth(true) - _.$slides.first().width();
|
1141
|
-
_.$slideTrack.children('.slick-slide').width(_.slideWidth - offset);
|
1188
|
+
if (_.options.variableWidth === false) _.$slideTrack.children('.slick-slide').width(_.slideWidth - offset);
|
1142
1189
|
|
1143
1190
|
};
|
1144
1191
|
|
@@ -1165,12 +1212,25 @@
|
|
1165
1212
|
|
1166
1213
|
};
|
1167
1214
|
|
1215
|
+
Slick.prototype.setHeight = function() {
|
1216
|
+
|
1217
|
+
var _ = this;
|
1218
|
+
|
1219
|
+
if(_.options.slidesToShow === 1 && _.options.adaptiveHeight === true && _.options.vertical === false) {
|
1220
|
+
var targetHeight = _.$slides.eq(_.currentSlide).outerHeight(true);
|
1221
|
+
_.$list.css('height', targetHeight);
|
1222
|
+
}
|
1223
|
+
|
1224
|
+
};
|
1225
|
+
|
1168
1226
|
Slick.prototype.setPosition = function() {
|
1169
1227
|
|
1170
1228
|
var _ = this;
|
1171
1229
|
|
1172
1230
|
_.setDimensions();
|
1173
1231
|
|
1232
|
+
_.setHeight();
|
1233
|
+
|
1174
1234
|
if (_.options.fade === false) {
|
1175
1235
|
_.setCSS(_.getLeft(_.currentSlide));
|
1176
1236
|
} else {
|
@@ -1181,7 +1241,8 @@
|
|
1181
1241
|
|
1182
1242
|
Slick.prototype.setProps = function() {
|
1183
1243
|
|
1184
|
-
var _ = this
|
1244
|
+
var _ = this,
|
1245
|
+
bodyStyle = document.body.style;
|
1185
1246
|
|
1186
1247
|
_.positionProp = _.options.vertical === true ? 'top' : 'left';
|
1187
1248
|
|
@@ -1191,36 +1252,44 @@
|
|
1191
1252
|
_.$slider.removeClass('slick-vertical');
|
1192
1253
|
}
|
1193
1254
|
|
1194
|
-
if (
|
1195
|
-
|
1196
|
-
|
1255
|
+
if (bodyStyle.WebkitTransition !== undefined ||
|
1256
|
+
bodyStyle.MozTransition !== undefined ||
|
1257
|
+
bodyStyle.msTransition !== undefined) {
|
1197
1258
|
if(_.options.useCSS === true) {
|
1198
1259
|
_.cssTransitions = true;
|
1199
1260
|
}
|
1200
1261
|
}
|
1201
1262
|
|
1202
|
-
if (
|
1263
|
+
if (bodyStyle.OTransform !== undefined) {
|
1264
|
+
_.animType = 'OTransform';
|
1265
|
+
_.transformType = "-o-transform";
|
1266
|
+
_.transitionType = 'OTransition';
|
1267
|
+
if (bodyStyle.perspectiveProperty === undefined && bodyStyle.webkitPerspective === undefined) _.animType = false;
|
1268
|
+
}
|
1269
|
+
if (bodyStyle.MozTransform !== undefined) {
|
1203
1270
|
_.animType = 'MozTransform';
|
1204
1271
|
_.transformType = "-moz-transform";
|
1205
1272
|
_.transitionType = 'MozTransition';
|
1273
|
+
if (bodyStyle.perspectiveProperty === undefined && bodyStyle.MozPerspective === undefined) _.animType = false;
|
1206
1274
|
}
|
1207
|
-
if (
|
1275
|
+
if (bodyStyle.webkitTransform !== undefined) {
|
1208
1276
|
_.animType = 'webkitTransform';
|
1209
1277
|
_.transformType = "-webkit-transform";
|
1210
1278
|
_.transitionType = 'webkitTransition';
|
1279
|
+
if (bodyStyle.perspectiveProperty === undefined && bodyStyle.webkitPerspective === undefined) _.animType = false;
|
1211
1280
|
}
|
1212
|
-
if (
|
1281
|
+
if (bodyStyle.msTransform !== undefined) {
|
1213
1282
|
_.animType = 'msTransform';
|
1214
1283
|
_.transformType = "-ms-transform";
|
1215
1284
|
_.transitionType = 'msTransition';
|
1285
|
+
if (bodyStyle.msTransform === undefined) _.animType = false;
|
1216
1286
|
}
|
1217
|
-
if (
|
1287
|
+
if (bodyStyle.transform !== undefined && _.animType !== false) {
|
1218
1288
|
_.animType = 'transform';
|
1219
1289
|
_.transformType = "transform";
|
1220
1290
|
_.transitionType = 'transition';
|
1221
1291
|
}
|
1222
|
-
|
1223
|
-
_.transformsEnabled = (_.animType !== null);
|
1292
|
+
_.transformsEnabled = (_.animType !== null && _.animType !== false);
|
1224
1293
|
|
1225
1294
|
};
|
1226
1295
|
|
@@ -1304,13 +1373,15 @@
|
|
1304
1373
|
for (i = _.slideCount; i > (_.slideCount -
|
1305
1374
|
infiniteCount); i -= 1) {
|
1306
1375
|
slideIndex = i - 1;
|
1307
|
-
$(_.$slides[slideIndex]).clone(true).attr('id', '')
|
1308
|
-
|
1376
|
+
$(_.$slides[slideIndex]).clone(true).attr('id', '')
|
1377
|
+
.attr('index', slideIndex-_.slideCount)
|
1378
|
+
.prependTo(_.$slideTrack).addClass('slick-cloned');
|
1309
1379
|
}
|
1310
1380
|
for (i = 0; i < infiniteCount; i += 1) {
|
1311
1381
|
slideIndex = i;
|
1312
|
-
$(_.$slides[slideIndex]).clone(true).attr('id', '')
|
1313
|
-
|
1382
|
+
$(_.$slides[slideIndex]).clone(true).attr('id', '')
|
1383
|
+
.attr('index', slideIndex+_.slideCount)
|
1384
|
+
.appendTo(_.$slideTrack).addClass('slick-cloned');
|
1314
1385
|
}
|
1315
1386
|
_.$slideTrack.find('.slick-cloned').find('[id]').each(function() {
|
1316
1387
|
$(this).attr('id', '');
|
@@ -1325,8 +1396,7 @@
|
|
1325
1396
|
Slick.prototype.selectHandler = function(event) {
|
1326
1397
|
|
1327
1398
|
var _ = this;
|
1328
|
-
var
|
1329
|
-
var index = parseInt($(event.target).parent().attr("index"));
|
1399
|
+
var index = parseInt($(event.target).parents('.slick-slide').attr("index"));
|
1330
1400
|
if(!index) index = 0;
|
1331
1401
|
|
1332
1402
|
if(_.slideCount <= _.options.slidesToShow){
|
@@ -1334,23 +1404,23 @@
|
|
1334
1404
|
}
|
1335
1405
|
_.slideHandler(index);
|
1336
1406
|
|
1337
|
-
if(asNavFor != null){
|
1338
|
-
if(asNavFor.slideCount <= asNavFor.options.slidesToShow){
|
1339
|
-
return;
|
1340
|
-
}
|
1341
|
-
asNavFor.slideHandler(index);
|
1342
|
-
}
|
1343
1407
|
};
|
1344
1408
|
|
1345
|
-
Slick.prototype.slideHandler = function(index) {
|
1409
|
+
Slick.prototype.slideHandler = function(index,sync) {
|
1346
1410
|
|
1347
1411
|
var targetSlide, animSlide, slideLeft, unevenOffset, targetLeft = null,
|
1348
1412
|
_ = this;
|
1349
1413
|
|
1350
|
-
|
1414
|
+
sync = sync || false;
|
1415
|
+
|
1416
|
+
if (_.animating === true && _.options.waitForAnimate === true) {
|
1351
1417
|
return false;
|
1352
1418
|
}
|
1353
1419
|
|
1420
|
+
if (sync === false) {
|
1421
|
+
_.asNavFor(index);
|
1422
|
+
}
|
1423
|
+
|
1354
1424
|
targetSlide = index;
|
1355
1425
|
targetLeft = _.getLeft(targetSlide);
|
1356
1426
|
slideLeft = _.getLeft(_.currentSlide);
|
@@ -1385,10 +1455,14 @@
|
|
1385
1455
|
if (_.slideCount % _.options.slidesToScroll !== 0) {
|
1386
1456
|
animSlide = _.slideCount - (_.slideCount % _.options.slidesToScroll);
|
1387
1457
|
} else {
|
1388
|
-
animSlide = _.slideCount
|
1458
|
+
animSlide = _.slideCount + targetSlide;
|
1459
|
+
}
|
1460
|
+
} else if (targetSlide >= _.slideCount) {
|
1461
|
+
if (_.slideCount % _.options.slidesToScroll !== 0) {
|
1462
|
+
animSlide = 0;
|
1463
|
+
} else {
|
1464
|
+
animSlide = targetSlide - _.slideCount;
|
1389
1465
|
}
|
1390
|
-
} else if (targetSlide > (_.slideCount - 1)) {
|
1391
|
-
animSlide = 0;
|
1392
1466
|
} else {
|
1393
1467
|
animSlide = targetSlide;
|
1394
1468
|
}
|
@@ -1469,8 +1543,7 @@
|
|
1469
1543
|
|
1470
1544
|
Slick.prototype.swipeEnd = function(event) {
|
1471
1545
|
|
1472
|
-
var _ = this;
|
1473
|
-
var asNavFor = _.options.asNavFor != null ? $(_.options.asNavFor).getSlick() : null;
|
1546
|
+
var _ = this, slideCount, slidesTraversed, swipeDiff;
|
1474
1547
|
|
1475
1548
|
_.dragging = false;
|
1476
1549
|
|
@@ -1486,23 +1559,27 @@
|
|
1486
1559
|
$(event.target).off('click.slick');
|
1487
1560
|
});
|
1488
1561
|
|
1562
|
+
if(_.options.swipeToSlide === true) {
|
1563
|
+
slidesTraversed = Math.round(_.touchObject.swipeLength / _.slideWidth);
|
1564
|
+
slideCount = slidesTraversed
|
1565
|
+
} else {
|
1566
|
+
slideCount = _.options.slidesToScroll;
|
1567
|
+
}
|
1568
|
+
|
1489
1569
|
switch (_.swipeDirection()) {
|
1490
1570
|
case 'left':
|
1491
|
-
_.slideHandler(_.currentSlide +
|
1492
|
-
if(asNavFor != null) asNavFor.slideHandler(asNavFor.currentSlide + asNavFor.options.slidesToScroll);
|
1571
|
+
_.slideHandler(_.currentSlide + slideCount);
|
1493
1572
|
_.touchObject = {};
|
1494
1573
|
break;
|
1495
1574
|
|
1496
1575
|
case 'right':
|
1497
|
-
_.slideHandler(_.currentSlide -
|
1498
|
-
if(asNavFor != null) asNavFor.slideHandler(asNavFor.currentSlide - asNavFor.options.slidesToScroll);
|
1576
|
+
_.slideHandler(_.currentSlide - slideCount);
|
1499
1577
|
_.touchObject = {};
|
1500
1578
|
break;
|
1501
1579
|
}
|
1502
1580
|
} else {
|
1503
1581
|
if(_.touchObject.startX !== _.touchObject.curX) {
|
1504
1582
|
_.slideHandler(_.currentSlide);
|
1505
|
-
if(asNavFor != null) asNavFor.slideHandler(asNavFor.currentSlide);
|
1506
1583
|
_.touchObject = {};
|
1507
1584
|
}
|
1508
1585
|
}
|
@@ -1515,7 +1592,7 @@
|
|
1515
1592
|
|
1516
1593
|
if ((_.options.swipe === false) || ('ontouchend' in document && _.options.swipe === false)) {
|
1517
1594
|
return;
|
1518
|
-
} else if (
|
1595
|
+
} else if (_.options.draggable === false && event.type.indexOf('mouse') !== -1) {
|
1519
1596
|
return;
|
1520
1597
|
}
|
1521
1598
|
|
@@ -1646,7 +1723,7 @@
|
|
1646
1723
|
_.$nextArrow.remove();
|
1647
1724
|
}
|
1648
1725
|
_.$slides.removeClass(
|
1649
|
-
'slick-slide slick-active slick-visible').
|
1726
|
+
'slick-slide slick-active slick-visible').css('width', '');
|
1650
1727
|
|
1651
1728
|
};
|
1652
1729
|
|
@@ -1718,9 +1795,12 @@
|
|
1718
1795
|
var _ = this;
|
1719
1796
|
return _.each(function(index, element) {
|
1720
1797
|
|
1721
|
-
|
1722
|
-
|
1723
|
-
|
1798
|
+
element.slick.changeSlide({
|
1799
|
+
data: {
|
1800
|
+
message: 'index',
|
1801
|
+
index: slide
|
1802
|
+
}
|
1803
|
+
});
|
1724
1804
|
|
1725
1805
|
});
|
1726
1806
|
};
|
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.3.
|
4
|
+
version: 1.3.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Guy Israeli
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-10-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|