slick_rails 1.3.6.1 → 1.3.6.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a3f4f5b653e4a28d15f78a74b8ed2dd900ba984b
4
- data.tar.gz: c98b8d6cfb7117e0bb84e387f33b72381bbc4080
3
+ metadata.gz: 7085903d53a93887c94b44ae3874dc01afdb2a70
4
+ data.tar.gz: f9d9ba3910021afbb5c26a5ff79a17323b533c2a
5
5
  SHA512:
6
- metadata.gz: 461a639668b874c494b54a5b1e09a6e843929054cdc7a22f6641aff12f91ad6093160f42d039a8e958ccd91744bdece2a98df3400905a312722e43c839c2c1e8
7
- data.tar.gz: 80bfcbb0fa104bb9bbd02697e4e2a571919530f5a556b72048d4c7eb3de9eea6f1b8bac60dac4098a871a1769aa3fc9232576cdba2e5b7d8228cb599cdde6949
6
+ metadata.gz: 43ad5e7a7231b9ffd826809f373933e5163a73e6f0a121aebf6500c3fd4337800c075a9307a1439a5e25a19ce1aa8c9f662463a7d342898be312b4e295fdfe19
7
+ data.tar.gz: 176a3c3c454d766b4447ba8bd3f7fa65f80ed34c0566a2499f659fc67281dd446ae110f96c1f470b8525d1489405a32978afa33b356666400fefc7733aa2b16e
@@ -40,7 +40,11 @@
40
40
 
41
41
  _.defaults = {
42
42
  accessibility: true,
43
+ appendArrows: $(element),
43
44
  arrows: true,
45
+ asNavFor: null,
46
+ prevArrow: '<button type="button" class="slick-prev">Previous</button>',
47
+ nextArrow: '<button type="button" class="slick-next">Next</button>',
44
48
  autoplay: false,
45
49
  autoplaySpeed: 3000,
46
50
  centerMode: false,
@@ -53,6 +57,7 @@
53
57
  draggable: true,
54
58
  easing: 'linear',
55
59
  fade: false,
60
+ focusOnSelect: false,
56
61
  infinite: true,
57
62
  lazyLoad: 'ondemand',
58
63
  onBeforeChange: null,
@@ -60,6 +65,7 @@
60
65
  onInit: null,
61
66
  onReInit: null,
62
67
  pauseOnHover: true,
68
+ pauseOnDotsHover: false,
63
69
  responsive: null,
64
70
  slide: 'div',
65
71
  slidesToShow: 1,
@@ -74,6 +80,7 @@
74
80
 
75
81
  _.initials = {
76
82
  animating: false,
83
+ dragging: false,
77
84
  autoPlayTimer: null,
78
85
  currentSlide: 0,
79
86
  currentLeft: null,
@@ -136,6 +143,7 @@
136
143
  _.autoPlay = $.proxy(_.autoPlay, _);
137
144
  _.autoPlayClear = $.proxy(_.autoPlayClear, _);
138
145
  _.changeSlide = $.proxy(_.changeSlide, _);
146
+ _.selectHandler = $.proxy(_.selectHandler, _);
139
147
  _.setPosition = $.proxy(_.setPosition, _);
140
148
  _.swipeHandler = $.proxy(_.swipeHandler, _);
141
149
  _.dragHandler = $.proxy(_.dragHandler, _);
@@ -144,6 +152,11 @@
144
152
 
145
153
  _.instanceUid = instanceUid++;
146
154
 
155
+ // A simple way to check for HTML strings
156
+ // Strict HTML recognition (must start with <)
157
+ // Extracted from jQuery v1.11 source
158
+ _.htmlExpr = /^(?:\s*(<[\w\W]+>)[^>]*)$/;
159
+
147
160
  _.init();
148
161
 
149
162
  }
@@ -187,6 +200,10 @@
187
200
 
188
201
  _.$slideTrack.append(_.$slides);
189
202
 
203
+ _.$slides.each(function(index, element) {
204
+ $(element).attr("index",index);
205
+ });
206
+
190
207
  _.$slidesCache = _.$slides;
191
208
 
192
209
  _.reinit();
@@ -311,6 +328,7 @@
311
328
  Slick.prototype.autoPlayIterator = function() {
312
329
 
313
330
  var _ = this;
331
+ var asNavFor = _.options.asNavFor != null ? $(_.options.asNavFor).getSlick() : null;
314
332
 
315
333
  if (_.options.infinite === false) {
316
334
 
@@ -321,8 +339,8 @@
321
339
  _.direction = 0;
322
340
  }
323
341
 
324
- _.slideHandler(_.currentSlide + _.options
325
- .slidesToScroll);
342
+ _.slideHandler(_.currentSlide + _.options.slidesToScroll);
343
+ if(asNavFor != null) asNavFor.slideHandler(asNavFor.currentSlide + asNavFor.options.slidesToScroll);
326
344
 
327
345
  } else {
328
346
 
@@ -332,14 +350,15 @@
332
350
 
333
351
  }
334
352
 
335
- _.slideHandler(_.currentSlide - _.options
336
- .slidesToScroll);
353
+ _.slideHandler(_.currentSlide - _.options.slidesToScroll);
354
+ if(asNavFor != null) asNavFor.slideHandler(asNavFor.currentSlide - asNavFor.options.slidesToScroll);
337
355
 
338
356
  }
339
357
 
340
358
  } else {
341
359
 
342
360
  _.slideHandler(_.currentSlide + _.options.slidesToScroll);
361
+ if(asNavFor != null) asNavFor.slideHandler(asNavFor.currentSlide + asNavFor.options.slidesToScroll);
343
362
 
344
363
  }
345
364
 
@@ -351,12 +370,16 @@
351
370
 
352
371
  if (_.options.arrows === true && _.slideCount > _.options.slidesToShow) {
353
372
 
354
- _.$prevArrow = $(
355
- '<button type="button" class="slick-prev">Previous</button>').appendTo(
356
- _.$slider);
357
- _.$nextArrow = $(
358
- '<button type="button" class="slick-next">Next</button>').appendTo(
359
- _.$slider);
373
+ _.$prevArrow = $(_.options.prevArrow);
374
+ _.$nextArrow = $(_.options.nextArrow);
375
+
376
+ if (_.htmlExpr.test(_.options.prevArrow)) {
377
+ _.$prevArrow.appendTo(_.options.appendArrows);
378
+ }
379
+
380
+ if (_.htmlExpr.test(_.options.nextArrow)) {
381
+ _.$nextArrow.appendTo(_.options.appendArrows);
382
+ }
360
383
 
361
384
  if (_.options.infinite !== true) {
362
385
  _.$prevArrow.addClass('slick-disabled');
@@ -399,6 +422,11 @@
399
422
  ':not(.slick-cloned)').addClass(
400
423
  'slick-slide');
401
424
  _.slideCount = _.$slides.length;
425
+
426
+ _.$slides.each(function(index, element) {
427
+ $(element).attr("index",index);
428
+ });
429
+
402
430
  _.$slidesCache = _.$slides;
403
431
 
404
432
  _.$slider.addClass('slick-slider');
@@ -412,7 +440,6 @@
412
440
  _.$slideTrack.css('opacity', 0);
413
441
 
414
442
  if (_.options.centerMode === true) {
415
- _.options.infinite = true;
416
443
  _.options.slidesToScroll = 1;
417
444
  if (_.options.slidesToShow % 2 === 0) {
418
445
  _.options.slidesToShow = 3;
@@ -427,11 +454,13 @@
427
454
 
428
455
  _.buildDots();
429
456
 
457
+ _.updateDots();
458
+
430
459
  if (_.options.accessibility === true) {
431
460
  _.$list.prop('tabIndex', 0);
432
461
  }
433
462
 
434
- _.setSlideClasses(0);
463
+ _.setSlideClasses(typeof this.currentSlide === 'number' ? this.currentSlide : 0);
435
464
 
436
465
  if (_.options.draggable === true) {
437
466
  _.$list.addClass('draggable');
@@ -464,14 +493,14 @@
464
493
  if (targetBreakpoint !== _.activeBreakpoint) {
465
494
  _.activeBreakpoint =
466
495
  targetBreakpoint;
467
- _.options = $.extend({}, _.defaults,
496
+ _.options = $.extend({}, _.options,
468
497
  _.breakpointSettings[
469
498
  targetBreakpoint]);
470
499
  _.refresh();
471
500
  }
472
501
  } else {
473
502
  _.activeBreakpoint = targetBreakpoint;
474
- _.options = $.extend({}, _.defaults,
503
+ _.options = $.extend({}, _.options,
475
504
  _.breakpointSettings[
476
505
  targetBreakpoint]);
477
506
  _.refresh();
@@ -479,7 +508,7 @@
479
508
  } else {
480
509
  if (_.activeBreakpoint !== null) {
481
510
  _.activeBreakpoint = null;
482
- _.options = $.extend({}, _.defaults,
511
+ _.options = $.extend({}, _.options,
483
512
  _.originalSettings);
484
513
  _.refresh();
485
514
  }
@@ -491,23 +520,35 @@
491
520
 
492
521
  Slick.prototype.changeSlide = function(event) {
493
522
 
494
- var _ = this;
523
+ var _ = this,
524
+ $target = $(event.target);
525
+ var asNavFor = _.options.asNavFor != null ? $(_.options.asNavFor).getSlick() : null;
526
+
527
+ // If target is a link, prevent default action.
528
+ $target.is('a') && event.preventDefault();
495
529
 
496
530
  switch (event.data.message) {
497
531
 
498
532
  case 'previous':
499
- _.slideHandler(_.currentSlide - _.options
533
+ if (_.slideCount > _.options.slidesToShow) {
534
+ _.slideHandler(_.currentSlide - _.options
500
535
  .slidesToScroll);
536
+ if(asNavFor != null) asNavFor.slideHandler(asNavFor.currentSlide - asNavFor.options.slidesToScroll);
537
+ }
501
538
  break;
502
539
 
503
540
  case 'next':
504
- _.slideHandler(_.currentSlide + _.options
541
+ if (_.slideCount > _.options.slidesToShow) {
542
+ _.slideHandler(_.currentSlide + _.options
505
543
  .slidesToScroll);
544
+ if(asNavFor != null) asNavFor.slideHandler(asNavFor.currentSlide + asNavFor.options.slidesToScroll);
545
+ }
506
546
  break;
507
547
 
508
548
  case 'index':
509
- _.slideHandler($(event.target).parent().index() * _.options.slidesToScroll);
510
- break;
549
+ var index = $(event.target).parent().index() * _.options.slidesToScroll;
550
+ _.slideHandler(index);
551
+ if(asNavFor != null) asNavFor.slideHandler(index); break;
511
552
 
512
553
  default:
513
554
  return false;
@@ -531,7 +572,9 @@
531
572
  _.$prevArrow.remove();
532
573
  _.$nextArrow.remove();
533
574
  }
534
- _.$slides.unwrap().unwrap();
575
+ if (_.$slides.parent().hasClass('slick-track')) {
576
+ _.$slides.unwrap().unwrap();
577
+ }
535
578
  _.$slides.removeClass(
536
579
  'slick-slide slick-active slick-visible').removeAttr('style');
537
580
  _.$slider.removeClass('slick-slider');
@@ -668,8 +711,10 @@
668
711
  }
669
712
  }
670
713
 
671
- if (_.options.centerMode === true) {
714
+ if (_.options.centerMode === true && _.options.infinite === true) {
672
715
  _.slideOffset += _.slideWidth * Math.floor(_.options.slidesToShow / 2) - _.slideWidth;
716
+ } else if (_.options.centerMode === true) {
717
+ _.slideOffset += _.slideWidth * Math.floor(_.options.slidesToShow / 2);
673
718
  }
674
719
 
675
720
  if (_.options.vertical === false) {
@@ -728,6 +773,12 @@
728
773
  }, _.changeSlide);
729
774
  }
730
775
 
776
+ if (_.options.dots === true && _.options.pauseOnDotsHover === true && _.options.autoplay === true) {
777
+ $('li', _.$dots)
778
+ .on('mouseenter.slick', _.autoPlayClear)
779
+ .on('mouseleave.slick', _.autoPlay);
780
+ }
781
+
731
782
  };
732
783
 
733
784
  Slick.prototype.initializeEvents = function() {
@@ -757,7 +808,11 @@
757
808
  }
758
809
 
759
810
  if(_.options.accessibility === true) {
760
- _.$list.on('keydown.slick', _.keyHandler);
811
+ _.$list.on('keydown.slick', _.keyHandler);
812
+ }
813
+
814
+ if(_.options.focusOnSelect === true) {
815
+ $(_.options.slide, _.$slideTrack).on('click.slick', _.selectHandler);
761
816
  }
762
817
 
763
818
  $(window).on('orientationchange.slick.slick-' + _.instanceUid, function() {
@@ -777,6 +832,7 @@
777
832
  });
778
833
 
779
834
  $(window).on('load.slick.slick-' + _.instanceUid, _.setPosition);
835
+ $(document).on('ready.slick.slick-' + _.instanceUid, _.setPosition);
780
836
 
781
837
  };
782
838
 
@@ -830,7 +886,21 @@
830
886
  var _ = this,
831
887
  loadRange, cloneRange, rangeStart, rangeEnd;
832
888
 
833
- if (_.options.centerMode === true) {
889
+ function loadImages(imagesScope) {
890
+ $('img[data-lazy]', imagesScope).each(function() {
891
+ var image = $(this),
892
+ imageSource = $(this).attr('data-lazy');
893
+
894
+ image
895
+ .css({ opacity: 0 })
896
+ .attr('src', imageSource)
897
+ .removeAttr('data-lazy')
898
+ .removeClass('slick-loading')
899
+ .load(function() { image.animate({ opacity: 1 }, 200); });
900
+ });
901
+ }
902
+
903
+ if (_.options.centerMode === true || _.options.fade === true ) {
834
904
  rangeStart = _.options.slidesToShow + _.currentSlide - 1;
835
905
  rangeEnd = rangeStart + _.options.slidesToShow + 2;
836
906
  } else {
@@ -839,27 +909,14 @@
839
909
  }
840
910
 
841
911
  loadRange = _.$slider.find('.slick-slide').slice(rangeStart, rangeEnd);
842
-
843
- $('img[data-lazy]', loadRange).not('[src]').each(function() {
844
- $(this).css({opacity: 0}).attr('src', $(this).attr('data-lazy')).removeClass('slick-loading').load(function(){
845
- $(this).animate({ opacity: 1 }, 200);
846
- });
847
- });
912
+ loadImages(loadRange);
848
913
 
849
914
  if (_.currentSlide >= _.slideCount - _.options.slidesToShow) {
850
915
  cloneRange = _.$slider.find('.slick-cloned').slice(0, _.options.slidesToShow);
851
- $('img[data-lazy]', cloneRange).not('[src]').each(function() {
852
- $(this).css({opacity: 0}).attr('src', $(this).attr('data-lazy')).removeClass('slick-loading').load(function(){
853
- $(this).animate({ opacity: 1 }, 200);
854
- });
855
- });
916
+ loadImages(cloneRange)
856
917
  } else if (_.currentSlide === 0) {
857
918
  cloneRange = _.$slider.find('.slick-cloned').slice(_.options.slidesToShow * -1);
858
- $('img[data-lazy]', cloneRange).not('[src]').each(function() {
859
- $(this).css({opacity: 0}).attr('src', $(this).attr('data-lazy')).removeClass('slick-loading').load(function(){
860
- $(this).animate({ opacity: 1 }, 200);
861
- });
862
- });
919
+ loadImages(cloneRange);
863
920
  }
864
921
 
865
922
  };
@@ -909,11 +966,12 @@
909
966
  var _ = this,
910
967
  imgCount, targetImage;
911
968
 
912
- imgCount = $('img[data-lazy]').not('[src]').length;
969
+ imgCount = $('img[data-lazy]').length;
913
970
 
914
971
  if (imgCount > 0) {
915
- targetImage = $($('img[data-lazy]', _.$slider).not('[src]').get(0));
972
+ targetImage = $('img[data-lazy]', _.$slider).first();
916
973
  targetImage.attr('src', targetImage.attr('data-lazy')).removeClass('slick-loading').load(function() {
974
+ targetImage.removeAttr('data-lazy');
917
975
  _.progressiveLazyLoad();
918
976
  });
919
977
  }
@@ -922,12 +980,14 @@
922
980
 
923
981
  Slick.prototype.refresh = function() {
924
982
 
925
- var _ = this;
983
+ var _ = this,
984
+ currentSlide = _.currentSlide;
926
985
 
927
986
  _.destroy();
928
987
 
929
988
  $.extend(_, _.initials);
930
989
 
990
+ _.currentSlide = currentSlide;
931
991
  _.init();
932
992
 
933
993
  };
@@ -961,6 +1021,10 @@
961
1021
 
962
1022
  _.initDotEvents();
963
1023
 
1024
+ if(_.options.focusOnSelect === true) {
1025
+ $(_.options.slide, _.$slideTrack).on('click.slick', _.selectHandler);
1026
+ }
1027
+
964
1028
  _.setSlideClasses(0);
965
1029
 
966
1030
  _.setPosition();
@@ -1164,17 +1228,21 @@
1164
1228
 
1165
1229
  centerOffset = Math.floor(_.options.slidesToShow / 2);
1166
1230
 
1167
- if (index >= centerOffset && index <= (_.slideCount - 1) - centerOffset) {
1168
- _.$slides.slice(index - centerOffset, index + centerOffset + 1).addClass('slick-active');
1169
- } else {
1170
- indexOffset = _.options.slidesToShow + index;
1171
- allSlides.slice(indexOffset - centerOffset + 1, indexOffset + centerOffset + 2).addClass('slick-active');
1172
- }
1231
+ if(_.options.infinite === true) {
1232
+
1233
+ if (index >= centerOffset && index <= (_.slideCount - 1) - centerOffset) {
1234
+ _.$slides.slice(index - centerOffset, index + centerOffset + 1).addClass('slick-active');
1235
+ } else {
1236
+ indexOffset = _.options.slidesToShow + index;
1237
+ allSlides.slice(indexOffset - centerOffset + 1, indexOffset + centerOffset + 2).addClass('slick-active');
1238
+ }
1239
+
1240
+ if (index === 0) {
1241
+ allSlides.eq(allSlides.length - 1 - _.options.slidesToShow).addClass('slick-center');
1242
+ } else if (index === _.slideCount - 1) {
1243
+ allSlides.eq(_.options.slidesToShow).addClass('slick-center');
1244
+ }
1173
1245
 
1174
- if (index === 0) {
1175
- allSlides.eq(allSlides.length - 1 - _.options.slidesToShow).addClass('slick-center');
1176
- } else if (index === _.slideCount - 1) {
1177
- allSlides.eq(_.options.slidesToShow).addClass('slick-center');
1178
1246
  }
1179
1247
 
1180
1248
  _.$slides.eq(index).addClass('slick-center');
@@ -1183,6 +1251,8 @@
1183
1251
 
1184
1252
  if (index > 0 && index < (_.slideCount - _.options.slidesToShow)) {
1185
1253
  _.$slides.slice(index, index + _.options.slidesToShow).addClass('slick-active');
1254
+ } else if ( allSlides.length <= _.options.slidesToShow ) {
1255
+ allSlides.addClass('slick-active');
1186
1256
  } else {
1187
1257
  indexOffset = _.options.infinite === true ? _.options.slidesToShow + index : index;
1188
1258
  allSlides.slice(indexOffset, indexOffset + _.options.slidesToShow).addClass('slick-active');
@@ -1238,6 +1308,26 @@
1238
1308
 
1239
1309
  };
1240
1310
 
1311
+ Slick.prototype.selectHandler = function(event) {
1312
+
1313
+ var _ = this;
1314
+ var asNavFor = _.options.asNavFor != null ? $(_.options.asNavFor).getSlick() : null;
1315
+ var index = parseInt($(event.target).parent().attr("index"));
1316
+ if(!index) index = 0;
1317
+
1318
+ if(_.slideCount <= _.options.slidesToShow){
1319
+ return;
1320
+ }
1321
+ _.slideHandler(index);
1322
+
1323
+ if(asNavFor != null){
1324
+ if(asNavFor.slideCount <= asNavFor.options.slidesToShow){
1325
+ return;
1326
+ }
1327
+ asNavFor.slideHandler(index);
1328
+ }
1329
+ };
1330
+
1241
1331
  Slick.prototype.slideHandler = function(index) {
1242
1332
 
1243
1333
  var targetSlide, animSlide, slideLeft, unevenOffset, targetLeft = null,
@@ -1255,7 +1345,15 @@
1255
1345
 
1256
1346
  _.currentLeft = _.swipeLeft === null ? slideLeft : _.swipeLeft;
1257
1347
 
1258
- if (_.options.infinite === false && (index < 0 || index > (_.slideCount - _.options.slidesToShow + unevenOffset))) {
1348
+ if (_.options.infinite === false && _.options.centerMode === false && (index < 0 || index > (_.slideCount - _.options.slidesToShow + unevenOffset))) {
1349
+ if(_.options.fade === false) {
1350
+ targetSlide = _.currentSlide;
1351
+ _.animateSlide(slideLeft, function() {
1352
+ _.postSlide(targetSlide);
1353
+ });
1354
+ }
1355
+ return false;
1356
+ } else if (_.options.infinite === false && _.options.centerMode === true && (index < 0 || index > (_.slideCount - _.options.slidesToScroll))) {
1259
1357
  if(_.options.fade === false) {
1260
1358
  targetSlide = _.currentSlide;
1261
1359
  _.animateSlide(slideLeft, function() {
@@ -1358,8 +1456,9 @@
1358
1456
  Slick.prototype.swipeEnd = function(event) {
1359
1457
 
1360
1458
  var _ = this;
1459
+ var asNavFor = _.options.asNavFor != null ? $(_.options.asNavFor).getSlick() : null;
1361
1460
 
1362
- _.$list.removeClass('dragging');
1461
+ _.dragging = false;
1363
1462
 
1364
1463
  if (_.touchObject.curX === undefined) {
1365
1464
  return false;
@@ -1376,17 +1475,20 @@
1376
1475
  switch (_.swipeDirection()) {
1377
1476
  case 'left':
1378
1477
  _.slideHandler(_.currentSlide + _.options.slidesToScroll);
1478
+ if(asNavFor != null) asNavFor.slideHandler(asNavFor.currentSlide + asNavFor.options.slidesToScroll);
1379
1479
  _.touchObject = {};
1380
1480
  break;
1381
1481
 
1382
1482
  case 'right':
1383
1483
  _.slideHandler(_.currentSlide - _.options.slidesToScroll);
1484
+ if(asNavFor != null) asNavFor.slideHandler(asNavFor.currentSlide - asNavFor.options.slidesToScroll);
1384
1485
  _.touchObject = {};
1385
1486
  break;
1386
1487
  }
1387
1488
  } else {
1388
1489
  if(_.touchObject.startX !== _.touchObject.curX) {
1389
1490
  _.slideHandler(_.currentSlide);
1491
+ if(asNavFor != null) asNavFor.slideHandler(asNavFor.currentSlide);
1390
1492
  _.touchObject = {};
1391
1493
  }
1392
1494
  }
@@ -1397,10 +1499,10 @@
1397
1499
 
1398
1500
  var _ = this;
1399
1501
 
1400
- if ('ontouchend' in document && _.options.swipe === false) {
1401
- return false;
1402
- } else if (_.options.draggable === false && !event.originalEvent.touches) {
1403
- return true;
1502
+ if ((_.options.swipe === false) || ('ontouchend' in document && _.options.swipe === false)) {
1503
+ return;
1504
+ } else if ((_.options.draggable === false) || (_.options.draggable === false && !event.originalEvent.touches)) {
1505
+ return;
1404
1506
  }
1405
1507
 
1406
1508
  _.touchObject.fingerCount = event.originalEvent && event.originalEvent.touches !== undefined ?
@@ -1436,7 +1538,7 @@
1436
1538
 
1437
1539
  curLeft = _.getLeft(_.currentSlide);
1438
1540
 
1439
- if (!_.$list.hasClass('dragging') || touches && touches.length !== 1) {
1541
+ if (!_.dragging || touches && touches.length !== 1) {
1440
1542
  return false;
1441
1543
  }
1442
1544
 
@@ -1495,7 +1597,7 @@
1495
1597
  _.touchObject.startX = _.touchObject.curX = touches !== undefined ? touches.pageX : event.clientX;
1496
1598
  _.touchObject.startY = _.touchObject.curY = touches !== undefined ? touches.pageY : event.clientY;
1497
1599
 
1498
- _.$list.addClass('dragging');
1600
+ _.dragging = true;
1499
1601
 
1500
1602
  };
1501
1603
 
@@ -1560,8 +1662,7 @@
1560
1662
  if (_.$dots !== null) {
1561
1663
 
1562
1664
  _.$dots.find('li').removeClass('slick-active');
1563
- _.$dots.find('li').eq(_.currentSlide / _.options.slidesToScroll).addClass(
1564
- 'slick-active');
1665
+ _.$dots.find('li').eq(Math.floor(_.currentSlide / _.options.slidesToScroll)).addClass('slick-active');
1565
1666
 
1566
1667
  }
1567
1668
 
@@ -1603,6 +1704,8 @@
1603
1704
  var _ = this;
1604
1705
  return _.each(function(index, element) {
1605
1706
 
1707
+ var asNavFor = element.slick.options.asNavFor != null ? $(element.slick.options.asNavFor) : null;
1708
+ if(asNavFor != null) asNavFor.slickGoTo(slide);
1606
1709
  element.slick.slideHandler(slide);
1607
1710
 
1608
1711
  });
@@ -1663,6 +1766,11 @@
1663
1766
  });
1664
1767
  };
1665
1768
 
1769
+ $.fn.slickGetOption = function(option) {
1770
+ var _ = this;
1771
+ return _.get(0).slick.options[option];
1772
+ };
1773
+
1666
1774
  $.fn.slickSetOption = function(option, value, refresh) {
1667
1775
  var _ = this;
1668
1776
  return _.each(function(index, element) {
@@ -1690,9 +1798,21 @@
1690
1798
  var _ = this;
1691
1799
  return _.each(function(index, element) {
1692
1800
 
1801
+ if (element.slick) {
1693
1802
  element.slick.destroy();
1803
+ }
1694
1804
 
1695
1805
  });
1696
1806
  };
1697
1807
 
1698
- }));
1808
+ $.fn.getSlick = function() {
1809
+ var s = null;
1810
+ var _ = this;
1811
+ _.each(function(index, element) {
1812
+ s = element.slick
1813
+ });
1814
+
1815
+ return s;
1816
+ };
1817
+
1818
+ }));
@@ -3,30 +3,36 @@
3
3
  // Default Variables
4
4
 
5
5
  $slick-font-path: "./fonts/" !default;
6
+ $slick-font-family: "slick" !default;
6
7
  $slick-loader-path: "./" !default;
7
8
  $slick-arrow-color: white !default;
8
9
  $slick-dot-color: black !default;
10
+ $slick-dot-color-active: $slick-dot-color !default;
9
11
  $slick-prev-character: '\2190' !default;
10
12
  $slick-next-character: '\2192' !default;
11
13
  $slick-dot-character: '\2022' !default;
14
+ $slick-dot-size: 6px !default;
15
+ $opacity-default: .75;
16
+ $opacity-on-hover: 1;
17
+ $opacity-not-active: .25;
12
18
 
13
19
 
14
20
  @function slick-image-url($url) {
15
21
  @if function-exists(image-url) {
16
- @return image-url($url);
22
+ @return image-url($url, false, false);
23
+ }
24
+ @else {
25
+ @return url($slick-loader-path + $url);
17
26
  }
18
- @else {
19
- @return url($slick-loader-path + $url);
20
- }
21
27
  }
22
28
 
23
29
  @function slick-font-url($url) {
24
30
  @if function-exists(font-url) {
25
- @return image-url($url);
31
+ @return font-url($url);
32
+ }
33
+ @else {
34
+ @return url($slick-font-path + $url);
26
35
  }
27
- @else {
28
- @return url($slick-font-path + $url);
29
- }
30
36
  }
31
37
 
32
38
  /* Slider */
@@ -44,7 +50,7 @@ $slick-dot-character: '\2022' !default;
44
50
  user-select: none;
45
51
  -ms-touch-action: none;
46
52
  touch-action: none;
47
- -webkit-tap-highlight-color: rgba(0,0,0,0);
53
+ -webkit-tap-highlight-color: transparent;
48
54
  }
49
55
  .slick-list {
50
56
  position: relative;
@@ -130,16 +136,17 @@ $slick-dot-character: '\2022' !default;
130
136
  }
131
137
 
132
138
  /* Icons */
133
-
134
- @font-face {
135
- font-family:"slick";
136
- src: slick-font-url("slick.eot");
137
- src: slick-font-url("slick.eot?#iefix") format("embedded-opentype"),
138
- slick-font-url("slick.woff") format("woff"),
139
- slick-font-url("slick.ttf") format("truetype"),
140
- slick-font-url("slick.svg#slick") format("svg");
141
- font-weight: normal;
142
- font-style: normal;
139
+ @if $slick-font-family == "slick" {
140
+ @font-face {
141
+ font-family:"slick";
142
+ src: slick-font-url("slick.eot");
143
+ src: slick-font-url("slick.eot?#iefix") format("embedded-opentype"),
144
+ slick-font-url("slick.woff") format("woff"),
145
+ slick-font-url("slick.ttf") format("truetype"),
146
+ slick-font-url("slick.svg#slick") format("svg");
147
+ font-weight: normal;
148
+ font-style: normal;
149
+ }
143
150
  }
144
151
 
145
152
  /* Arrows */
@@ -160,19 +167,24 @@ $slick-dot-character: '\2022' !default;
160
167
  padding: 0;
161
168
  border: none;
162
169
  outline: none;
163
- &:focus {
164
- outline: none;
170
+ &:hover, &:focus {
171
+ outline: none;
172
+ background: transparent;
173
+ color: transparent;
174
+ &:before {
175
+ opacity: $opacity-on-hover;
176
+ }
165
177
  }
166
178
  &.slick-disabled:before {
167
- opacity: 0.25;
179
+ opacity: $opacity-not-active;
168
180
  }
169
181
  }
170
182
  .slick-prev:before, .slick-next:before {
171
- font-family:"slick";
183
+ font-family: $slick-font-family;
172
184
  font-size: 20px;
173
185
  line-height: 1;
174
186
  color: $slick-arrow-color;
175
- opacity: 0.85;
187
+ opacity: $opacity-default;
176
188
  -webkit-font-smoothing: antialiased;
177
189
  -moz-osx-font-smoothing: grayscale;
178
190
  }
@@ -200,7 +212,7 @@ $slick-dot-character: '\2022' !default;
200
212
  list-style: none;
201
213
  display: block;
202
214
  text-align: center;
203
- padding: 0px;
215
+ padding: 0;
204
216
  width: 100%;
205
217
 
206
218
  li {
@@ -208,8 +220,8 @@ $slick-dot-character: '\2022' !default;
208
220
  display: inline-block;
209
221
  height: 20px;
210
222
  width: 20px;
211
- margin: 0px 5px;
212
- padding: 0px;
223
+ margin: 0 5px;
224
+ padding: 0;
213
225
  cursor: pointer;
214
226
 
215
227
  button {
@@ -218,14 +230,17 @@ $slick-dot-character: '\2022' !default;
218
230
  display: block;
219
231
  height: 20px;
220
232
  width: 20px;
221
- outline: 0;
233
+ outline: none;
222
234
  line-height: 0;
223
235
  font-size: 0;
224
236
  color: transparent;
225
237
  padding: 5px;
226
238
  cursor: pointer;
227
- &:focus {
228
- outline: 0;
239
+ &:hover, &:focus {
240
+ outline: none;
241
+ &:before {
242
+ opacity: $opacity-on-hover;
243
+ }
229
244
  }
230
245
 
231
246
  &:before {
@@ -235,12 +250,12 @@ $slick-dot-character: '\2022' !default;
235
250
  content: $slick-dot-character;
236
251
  width: 20px;
237
252
  height: 20px;
238
- font-family:"slick";
239
- font-size: 6px;
253
+ font-family: $slick-font-family;
254
+ font-size: $slick-dot-size;
240
255
  line-height: 20px;
241
256
  text-align: center;
242
257
  color: $slick-dot-color;
243
- opacity: 0.25;
258
+ opacity: $opacity-not-active;
244
259
  -webkit-font-smoothing: antialiased;
245
260
  -moz-osx-font-smoothing: grayscale;
246
261
  }
@@ -248,7 +263,8 @@ $slick-dot-character: '\2022' !default;
248
263
  }
249
264
 
250
265
  &.slick-active button:before {
251
- opacity: 0.75;
266
+ color: $slick-dot-color-active;
267
+ opacity: $opacity-default;
252
268
  }
253
269
  }
254
270
  }
@@ -1,3 +1,3 @@
1
1
  module SlickRails
2
- VERSION = "1.3.6.1"
2
+ VERSION = "1.3.6.2"
3
3
  end
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.6.1
4
+ version: 1.3.6.2
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-06-03 00:00:00.000000000 Z
11
+ date: 2014-06-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler