slick_rails 1.3.4.1 → 1.3.5

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: 35ea9b05b7b63a259908075a5495ecb2494d835d
4
- data.tar.gz: 12139e88ff48d3a279ecafd6292e6fab98e0b975
3
+ metadata.gz: 7c2813cedd34a179b68eaf92f3f1f717a6ab3ad1
4
+ data.tar.gz: 8c591f0a4ebaf3e114ded688931ecd4d4af50ccf
5
5
  SHA512:
6
- metadata.gz: 8a397589e9c65864e9fe12308d0ea2898d3ceda5cea0282a11b8d76502cd2bd99c47d42f8b79451f962ddfcb39eecbde87ffaa56cc485e1b53c6310eca20b074
7
- data.tar.gz: ec46fb958b9fb283273eeffba772535a984fbd693d1ccadc299d62d1d3da3a4c6a90ef11a9deabce5fc05cbe44c21d3dc502f3518ae45626767481b7c3f66585
6
+ metadata.gz: 44c231aa0bfc0ee91997ea4a1fd53742d6b326735b8b2b5cd1b73e2ae17c36f4d460ec13704d914589edb72142186625d922f6bf69adb4cb2f4b5292934790ee
7
+ data.tar.gz: 30331f179ae37b055f434c03f3783638c0de76999c97e00cd8fb3cb46df4ce84bd5688f7f021a64521f8fd45b5628f3fa05e7b4133e055522008f81689588410
@@ -185,6 +185,8 @@
185
185
 
186
186
  _.$slideTrack.append(_.$slides);
187
187
 
188
+ _.$slidesCache = _.$slides;
189
+
188
190
  _.reinit();
189
191
 
190
192
  };
@@ -223,7 +225,7 @@
223
225
  _.$slideTrack.css(animProps);
224
226
  } else {
225
227
  animProps[_.animType] = 'translate(0px,' +
226
- now + 'px,0px)';
228
+ now + 'px)';
227
229
  _.$slideTrack.css(animProps);
228
230
  }
229
231
  },
@@ -738,16 +740,14 @@
738
740
  action: 'end'
739
741
  }, _.swipeHandler);
740
742
 
741
- _.$list.on('dragstart.slick', function(e) {
742
- e.preventDefault();
743
- });
744
-
745
743
  if (_.options.pauseOnHover === true && _.options.autoplay === true) {
746
744
  _.$list.on('mouseenter.slick', _.autoPlayClear);
747
745
  _.$list.on('mouseleave.slick', _.autoPlay);
748
746
  }
749
747
 
750
- _.$list.on('keydown.slick', _.keyHandler);
748
+ if(_.options.accessibility === true) {
749
+ _.$list.on('keydown.slick', _.keyHandler);
750
+ }
751
751
 
752
752
  $(window).on('orientationchange.slick.slick-' + _.instanceUid, function() {
753
753
  _.checkResponsive();
@@ -830,18 +830,24 @@
830
830
  loadRange = _.$slider.find('.slick-slide').slice(rangeStart, rangeEnd);
831
831
 
832
832
  $('img[data-lazy]', loadRange).not('[src]').each(function() {
833
- $(this).attr('src', $(this).attr('data-lazy')).removeClass('slick-loading');
833
+ $(this).css({opacity: 0}).attr('src', $(this).attr('data-lazy')).removeClass('slick-loading').load(function(){
834
+ $(this).animate({ opacity: 1 }, 200);
835
+ });
834
836
  });
835
837
 
836
838
  if (_.currentSlide >= _.slideCount - _.options.slidesToShow) {
837
839
  cloneRange = _.$slider.find('.slick-cloned').slice(0, _.options.slidesToShow);
838
840
  $('img[data-lazy]', cloneRange).not('[src]').each(function() {
839
- $(this).attr('src', $(this).attr('data-lazy')).removeClass('slick-loading');
841
+ $(this).css({opacity: 0}).attr('src', $(this).attr('data-lazy')).removeClass('slick-loading').load(function(){
842
+ $(this).animate({ opacity: 1 }, 200);
843
+ });
840
844
  });
841
845
  } else if (_.currentSlide === 0) {
842
846
  cloneRange = _.$slider.find('.slick-cloned').slice(_.options.slidesToShow * -1);
843
847
  $('img[data-lazy]', cloneRange).not('[src]').each(function() {
844
- $(this).attr('src', $(this).attr('data-lazy')).removeClass('slick-loading');
848
+ $(this).css({opacity: 0}).attr('src', $(this).attr('data-lazy')).removeClass('slick-loading').load(function(){
849
+ $(this).animate({ opacity: 1 }, 200);
850
+ });
845
851
  });
846
852
  }
847
853
 
@@ -857,30 +863,12 @@
857
863
  opacity: 1
858
864
  });
859
865
 
860
- if (document.readyState !== 'complete') {
861
-
862
- $(window).load(function() {
863
-
864
- _.$slider.removeClass('slick-loading');
865
-
866
- _.initUI();
866
+ _.$slider.removeClass('slick-loading');
867
867
 
868
- if (_.options.lazyLoad === 'progressive') {
869
- _.progressiveLazyLoad();
870
- }
871
-
872
- });
873
-
874
- } else {
875
-
876
- _.$slider.removeClass('slick-loading');
877
-
878
- _.initUI();
879
-
880
- if (_.options.lazyLoad === 'progressive') {
881
- _.progressiveLazyLoad();
882
- }
868
+ _.initUI();
883
869
 
870
+ if (_.options.lazyLoad === 'progressive') {
871
+ _.progressiveLazyLoad();
884
872
  }
885
873
 
886
874
  };
@@ -889,22 +877,16 @@
889
877
 
890
878
  var _ = this;
891
879
 
892
- if (_.options.onAfterChange !== null && index !== _.currentSlide) {
880
+ if (_.options.onAfterChange !== null) {
893
881
  _.options.onAfterChange.call(this, _, index);
894
882
  }
895
883
 
896
884
  _.animating = false;
897
885
 
898
- _.currentSlide = index;
899
-
900
886
  _.setPosition();
901
887
 
902
888
  _.swipeLeft = null;
903
889
 
904
- _.updateDots();
905
-
906
- _.updateArrows();
907
-
908
890
  if (_.options.autoplay === true && _.paused === false) {
909
891
  _.autoPlay();
910
892
  }
@@ -1006,6 +988,8 @@
1006
988
 
1007
989
  _.$slideTrack.append(_.$slides);
1008
990
 
991
+ _.$slidesCache = _.$slides;
992
+
1009
993
  _.reinit();
1010
994
 
1011
995
  };
@@ -1040,15 +1024,15 @@
1040
1024
  var _ = this;
1041
1025
 
1042
1026
  if (_.options.centerMode === true) {
1043
- _.$list.find('.slick-slide').width(_.slideWidth);
1027
+ _.$slideTrack.children('.slick-slide').width(_.slideWidth);
1044
1028
  } else {
1045
- _.$list.find('.slick-slide').width(_.slideWidth);
1029
+ _.$slideTrack.children('.slick-slide').width(_.slideWidth);
1046
1030
  }
1047
1031
 
1048
1032
 
1049
1033
  if (_.options.vertical === false) {
1050
1034
  _.$slideTrack.width(Math.ceil((_.slideWidth * _
1051
- .$slider.find('.slick-slide').length)));
1035
+ .$slideTrack.children('.slick-slide').length)));
1052
1036
  if (_.options.centerMode === true) {
1053
1037
  _.$list.css({
1054
1038
  padding: ('0px ' + _.options.centerPadding)
@@ -1057,7 +1041,7 @@
1057
1041
  } else {
1058
1042
  _.$list.height(_.$slides.first().outerHeight());
1059
1043
  _.$slideTrack.height(Math.ceil((_.listHeight * _
1060
- .$slider.find('.slick-slide').length)));
1044
+ .$slideTrack.children('.slick-slide').length)));
1061
1045
  if (_.options.centerMode === true) {
1062
1046
  _.$list.css({
1063
1047
  padding: (_.options.centerPadding + ' 0px')
@@ -1244,7 +1228,7 @@
1244
1228
 
1245
1229
  Slick.prototype.slideHandler = function(index) {
1246
1230
 
1247
- var targetSlide, animSlide, slideLeft, targetLeft = null,
1231
+ var targetSlide, animSlide, slideLeft, unevenOffset, targetLeft = null,
1248
1232
  _ = this;
1249
1233
 
1250
1234
  if (_.animating === true) {
@@ -1255,7 +1239,11 @@
1255
1239
  targetLeft = _.getLeft(targetSlide);
1256
1240
  slideLeft = _.getLeft(_.currentSlide);
1257
1241
 
1258
- if (_.options.infinite === false && (index < 0 || index > (_.slideCount - _.options.slidesToShow))) {
1242
+ unevenOffset = _.slideCount % _.options.slidesToScroll !== 0 ? _.options.slidesToScroll : 0;
1243
+
1244
+ _.currentLeft = _.swipeLeft === null ? slideLeft : _.swipeLeft;
1245
+
1246
+ if (_.options.infinite === false && (index < 0 || index > (_.slideCount - _.options.slidesToShow + unevenOffset))) {
1259
1247
  targetSlide = _.currentSlide;
1260
1248
  _.animateSlide(slideLeft, function() {
1261
1249
  _.postSlide(targetSlide);
@@ -1267,8 +1255,6 @@
1267
1255
  clearInterval(_.autoPlayTimer);
1268
1256
  }
1269
1257
 
1270
- _.currentLeft = _.swipeLeft === null ? slideLeft : _.swipeLeft;
1271
-
1272
1258
  if (targetSlide < 0) {
1273
1259
  if (_.slideCount % _.options.slidesToScroll !== 0) {
1274
1260
  animSlide = _.slideCount - (_.slideCount % _.options.slidesToScroll);
@@ -1284,9 +1270,13 @@
1284
1270
  _.animating = true;
1285
1271
 
1286
1272
  if (_.options.onBeforeChange !== null && index !== _.currentSlide) {
1287
- _.options.onBeforeChange.call(this, _, _.currentSlide);
1273
+ _.options.onBeforeChange.call(this, _, _.currentSlide, animSlide);
1288
1274
  }
1289
1275
 
1276
+ _.currentSlide = animSlide;
1277
+ _.updateDots();
1278
+ _.updateArrows();
1279
+
1290
1280
  if (_.options.fade === true) {
1291
1281
  _.fadeSlide(animSlide, function() {
1292
1282
  _.postSlide(animSlide);
@@ -1359,7 +1349,6 @@
1359
1349
  }
1360
1350
 
1361
1351
  if (_.touchObject.swipeLength >= _.touchObject.minSwipe) {
1362
-
1363
1352
  $(event.target).on('click.slick', function(event) {
1364
1353
  event.stopImmediatePropagation();
1365
1354
  event.stopPropagation();
@@ -1378,10 +1367,11 @@
1378
1367
  _.touchObject = {};
1379
1368
  break;
1380
1369
  }
1381
-
1382
1370
  } else {
1383
- _.slideHandler(_.currentSlide);
1384
- _.touchObject = {};
1371
+ if(_.touchObject.startX !== _.touchObject.curX) {
1372
+ _.slideHandler(_.currentSlide);
1373
+ _.touchObject = {};
1374
+ }
1385
1375
  }
1386
1376
 
1387
1377
  };
@@ -1390,9 +1380,9 @@
1390
1380
 
1391
1381
  var _ = this;
1392
1382
 
1393
- if (event.originalEvent && event.originalEvent.touches && _.options.swipe === false) {
1383
+ if ('ontouchend' in document && _.options.swipe === false) {
1394
1384
  return false;
1395
- } else if (_.options.draggable === false) {
1385
+ } else if (_.options.draggable === false && !event.originalEvent.touches) {
1396
1386
  return false;
1397
1387
  }
1398
1388
 
@@ -1442,10 +1432,10 @@
1442
1432
  swipeDirection = _.swipeDirection();
1443
1433
 
1444
1434
  if (swipeDirection === 'vertical') {
1445
- return false;
1435
+ return;
1446
1436
  }
1447
1437
 
1448
- if (event.originalEvent !== undefined) {
1438
+ if (event.originalEvent !== undefined && _.touchObject.swipeLength > 4) {
1449
1439
  event.preventDefault();
1450
1440
  }
1451
1441
 
@@ -1,3 +1,3 @@
1
1
  module SlickRails
2
- VERSION = "1.3.4.1"
2
+ VERSION = "1.3.5"
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.4.1
4
+ version: 1.3.5
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-04-14 00:00:00.000000000 Z
11
+ date: 2014-04-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler