slick_rails 1.5.2 → 1.5.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5b4a1fe287c4857309ce87eab3f3cc9d0f8021dc
4
- data.tar.gz: f81dda6d3c2d278f96a7ec581732bdb81aa51630
3
+ metadata.gz: 1aaf29f47ca390d6be9f4f134e33d33e118e34e8
4
+ data.tar.gz: 6cb850e912efeaaf0a6e41bc1163a7ac77ce08b1
5
5
  SHA512:
6
- metadata.gz: 0cd9b1813833ee4756e2181148d565c3e68a09280caadee150badd25d4798e017d6c63b08158789854d7c0e574620fce6a42828cb97af1c10358442e21d15dcc
7
- data.tar.gz: 4209ad272724e943ee92d2ef6bfec57e674ccf924f9ae4bf3688bef7005830bcf91c8f6ceecadbd94f0dd0a5f92d3ec5f0ebc0422c270a3096fe100f402bbf32
6
+ metadata.gz: c7c583da58f8d47c3eca2172da53fa66cc172befb98ac2c1faf78f088c52c0db88d369073838cb09896a815d47e2e8c842b25954b491eca542bd683ea6624d75
7
+ data.tar.gz: 2a6c59692c338d63dd1c397d2121b00ad6145c5f3170ba0c5ba4275ef57092ede1cdf3f6b793097d69f53b4482fe8f81a396044e0393df740ffbc7551f61b90e
@@ -6,7 +6,7 @@
6
6
  |___/_|_|\___|_|\_(_)/ |___/
7
7
  |__/
8
8
 
9
- Version: 1.5.2
9
+ Version: 1.5.3
10
10
  Author: Ken Wheeler
11
11
  Website: http://kenwheeler.github.io
12
12
  Docs: http://kenwheeler.github.io/slick
@@ -111,7 +111,8 @@
111
111
  swipeLeft: null,
112
112
  $list: null,
113
113
  touchObject: {},
114
- transformsEnabled: false
114
+ transformsEnabled: false,
115
+ unslicked: false
115
116
  };
116
117
 
117
118
  $.extend(_, _.initials);
@@ -191,7 +192,7 @@
191
192
  // Extracted from jQuery v1.11 source
192
193
  _.htmlExpr = /^(?:\s*(<[\w\W]+>)[^>]*)$/;
193
194
 
194
- _.init();
195
+ _.init(true);
195
196
 
196
197
  _.checkResponsive(true);
197
198
 
@@ -337,9 +338,23 @@
337
338
  };
338
339
 
339
340
  Slick.prototype.asNavFor = function(index) {
341
+
340
342
  var _ = this,
341
- asNavFor = _.options.asNavFor !== null ? $(_.options.asNavFor).slick('getSlick') : null;
342
- if (asNavFor !== null) asNavFor.slideHandler(index, true);
343
+ asNavFor = _.options.asNavFor;
344
+
345
+ if ( asNavFor && asNavFor !== null ) {
346
+ asNavFor = $(asNavFor).not(_.$slider);
347
+ }
348
+
349
+ if ( asNavFor !== null && typeof asNavFor === "object" ) {
350
+ asNavFor.each(function() {
351
+ var target = $(this).slick('getSlick');
352
+ if(!target.unslicked) {
353
+ target.slideHandler(index, true);
354
+ }
355
+ });
356
+ }
357
+
343
358
  };
344
359
 
345
360
  Slick.prototype.applyTransition = function(slide) {
@@ -558,9 +573,10 @@
558
573
  Slick.prototype.checkResponsive = function(initial) {
559
574
 
560
575
  var _ = this,
561
- breakpoint, targetBreakpoint, respondToWidth;
576
+ breakpoint, targetBreakpoint, respondToWidth, triggerBreakpoint = false;
562
577
  var sliderWidth = _.$slider.width();
563
578
  var windowWidth = window.innerWidth || $(window).width();
579
+
564
580
  if (_.respondTo === 'window') {
565
581
  respondToWidth = windowWidth;
566
582
  } else if (_.respondTo === 'slider') {
@@ -594,42 +610,49 @@
594
610
  _.activeBreakpoint =
595
611
  targetBreakpoint;
596
612
  if (_.breakpointSettings[targetBreakpoint] === 'unslick') {
597
- _.unslick();
613
+ _.unslick(targetBreakpoint);
598
614
  } else {
599
615
  _.options = $.extend({}, _.originalSettings,
600
616
  _.breakpointSettings[
601
617
  targetBreakpoint]);
602
- if (initial === true)
618
+ if (initial === true) {
603
619
  _.currentSlide = _.options.initialSlide;
604
- _.refresh();
620
+ }
621
+ _.refresh(initial);
605
622
  }
606
- _.$slider.trigger('breakpoint', [_, targetBreakpoint]);
623
+ triggerBreakpoint = targetBreakpoint;
607
624
  }
608
625
  } else {
609
626
  _.activeBreakpoint = targetBreakpoint;
610
627
  if (_.breakpointSettings[targetBreakpoint] === 'unslick') {
611
- _.unslick();
628
+ _.unslick(targetBreakpoint);
612
629
  } else {
613
630
  _.options = $.extend({}, _.originalSettings,
614
631
  _.breakpointSettings[
615
632
  targetBreakpoint]);
616
- if (initial === true)
633
+ if (initial === true) {
617
634
  _.currentSlide = _.options.initialSlide;
618
- _.refresh();
635
+ }
636
+ _.refresh(initial);
619
637
  }
620
- _.$slider.trigger('breakpoint', [_, targetBreakpoint]);
638
+ triggerBreakpoint = targetBreakpoint;
621
639
  }
622
640
  } else {
623
641
  if (_.activeBreakpoint !== null) {
624
642
  _.activeBreakpoint = null;
625
643
  _.options = _.originalSettings;
626
- if (initial === true)
644
+ if (initial === true) {
627
645
  _.currentSlide = _.options.initialSlide;
628
- _.refresh();
629
- _.$slider.trigger('breakpoint', [_, targetBreakpoint]);
646
+ }
647
+ _.refresh(initial);
648
+ triggerBreakpoint = targetBreakpoint;
630
649
  }
631
650
  }
632
651
 
652
+ // only trigger breakpoints during an actual break. not on initialize.
653
+ if( !initial && triggerBreakpoint !== false ) {
654
+ _.$slider.trigger('breakpoint', [_, triggerBreakpoint]);
655
+ }
633
656
  }
634
657
 
635
658
  };
@@ -641,7 +664,14 @@
641
664
  indexOffset, slideOffset, unevenOffset;
642
665
 
643
666
  // If target is a link, prevent default action.
644
- $target.is('a') && event.preventDefault();
667
+ if($target.is('a')) {
668
+ event.preventDefault();
669
+ }
670
+
671
+ // If target is not the <li> element (ie: a child), find the <li>.
672
+ if(!$target.is('li')) {
673
+ $target = $target.closest('li');
674
+ }
645
675
 
646
676
  unevenOffset = (_.slideCount % _.options.slidesToScroll !== 0);
647
677
  indexOffset = unevenOffset ? 0 : (_.slideCount - _.currentSlide) % _.options.slidesToScroll;
@@ -664,9 +694,10 @@
664
694
 
665
695
  case 'index':
666
696
  var index = event.data.index === 0 ? 0 :
667
- event.data.index || $(event.target).parent().index() * _.options.slidesToScroll;
697
+ event.data.index || $target.index() * _.options.slidesToScroll;
668
698
 
669
699
  _.slideHandler(_.checkNavigable(index), false, dontAnimate);
700
+ $target.children().trigger("focus");
670
701
  break;
671
702
 
672
703
  default:
@@ -701,14 +732,18 @@
701
732
 
702
733
  var _ = this;
703
734
 
704
- if (_.options.dots === true && _.slideCount > _.options.slidesToShow) {
735
+ if (_.options.dots && _.$dots !== null) {
736
+
705
737
  $('li', _.$dots).off('click.slick', _.changeSlide);
706
- }
707
738
 
708
- if (_.options.dots === true && _.options.pauseOnDotsHover === true && _.options.autoplay === true) {
709
- $('li', _.$dots)
710
- .off('mouseenter.slick', $.proxy(_.setPaused, _, true))
711
- .off('mouseleave.slick', $.proxy(_.setPaused, _, false));
739
+ if (_.options.pauseOnDotsHover === true && _.options.autoplay === true) {
740
+
741
+ $('li', _.$dots)
742
+ .off('mouseenter.slick', $.proxy(_.setPaused, _, true))
743
+ .off('mouseleave.slick', $.proxy(_.setPaused, _, false));
744
+
745
+ }
746
+
712
747
  }
713
748
 
714
749
  if (_.options.arrows === true && _.slideCount > _.options.slidesToShow) {
@@ -819,6 +854,8 @@
819
854
  _.$slider.removeClass('slick-slider');
820
855
  _.$slider.removeClass('slick-initialized');
821
856
 
857
+ _.unslicked = true;
858
+
822
859
  };
823
860
 
824
861
  Slick.prototype.disableTransition = function(slide) {
@@ -1019,8 +1056,7 @@
1019
1056
  max;
1020
1057
 
1021
1058
  if (_.options.infinite === false) {
1022
- max = _.slideCount - _.options.slidesToShow + 1;
1023
- if (_.options.centerMode === true) max = _.slideCount;
1059
+ max = _.slideCount;
1024
1060
  } else {
1025
1061
  breakPoint = _.options.slidesToScroll * -1;
1026
1062
  counter = _.options.slidesToScroll * -1;
@@ -1081,7 +1117,7 @@
1081
1117
 
1082
1118
  };
1083
1119
 
1084
- Slick.prototype.init = function() {
1120
+ Slick.prototype.init = function(creation) {
1085
1121
 
1086
1122
  var _ = this;
1087
1123
 
@@ -1098,7 +1134,9 @@
1098
1134
  _.updateDots();
1099
1135
  }
1100
1136
 
1101
- _.$slider.trigger('init', [_]);
1137
+ if (creation) {
1138
+ _.$slider.trigger('init', [_]);
1139
+ }
1102
1140
 
1103
1141
  };
1104
1142
 
@@ -1407,7 +1445,7 @@
1407
1445
 
1408
1446
  };
1409
1447
 
1410
- Slick.prototype.refresh = function() {
1448
+ Slick.prototype.refresh = function( initializing ) {
1411
1449
 
1412
1450
  var _ = this,
1413
1451
  currentSlide = _.currentSlide;
@@ -1418,12 +1456,16 @@
1418
1456
 
1419
1457
  _.init();
1420
1458
 
1421
- _.changeSlide({
1422
- data: {
1423
- message: 'index',
1424
- index: currentSlide
1425
- }
1426
- }, false);
1459
+ if( !initializing ) {
1460
+
1461
+ _.changeSlide({
1462
+ data: {
1463
+ message: 'index',
1464
+ index: currentSlide
1465
+ }
1466
+ }, false);
1467
+
1468
+ }
1427
1469
 
1428
1470
  };
1429
1471
 
@@ -1481,7 +1523,7 @@
1481
1523
  _.windowDelay = window.setTimeout(function() {
1482
1524
  _.windowWidth = $(window).width();
1483
1525
  _.checkResponsive();
1484
- _.setPosition();
1526
+ if( !_.unslicked ) { _.setPosition(); }
1485
1527
  }, 50);
1486
1528
  }
1487
1529
  };
@@ -2236,9 +2278,10 @@
2236
2278
 
2237
2279
  };
2238
2280
 
2239
- Slick.prototype.unslick = function() {
2281
+ Slick.prototype.unslick = function(fromBreakpoint) {
2240
2282
 
2241
2283
  var _ = this;
2284
+ _.$slider.trigger('unslick', [_, fromBreakpoint]);
2242
2285
  _.destroy();
2243
2286
 
2244
2287
  };
@@ -1,3 +1,3 @@
1
1
  module SlickRails
2
- VERSION = "1.5.2"
2
+ VERSION = "1.5.3"
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.5.2
4
+ version: 1.5.3
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-04-24 00:00:00.000000000 Z
11
+ date: 2015-05-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler