bxslider-rails 4.2.4 → 4.2.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: a5721fb2873fdb30cb74d32487970720006cf203
4
- data.tar.gz: e47d256bec47b063a34e0c548269fbf19a352831
3
+ metadata.gz: 630db28c0df83697c6a0e0e0baaa581eadab28fa
4
+ data.tar.gz: 2813810f566a64a817a7df72cf0c0b5dd11d0c1f
5
5
  SHA512:
6
- metadata.gz: d9bc9088ffb39c70dfd6558e5461ed32b62334ea24f8c42e6ccb771aa0a92da5a17b1189ce3de9335264aca14ecdee44d5088ea261b0d62c449e89d8d7b1abef
7
- data.tar.gz: 2063d3858c87b1b0b202e7993652928f58823af43851a3211675d805243b5b048e00f953a2fd2492d6d7f04efe588cd087a7c89a69420fade5ce93d16c36faae
6
+ metadata.gz: e42be24b8ea7abef6cdcccbc9219600d5d1356690f2c6b45fe20a7683e6379e69c15b83655a0ca4fbbd36e37bc621ad0469d778d1e5741698cc4f615f4f047e0
7
+ data.tar.gz: 0072fdf5f3e74382bc4caa170ee477f7004d08338d43043fd89bb774258cc4ce76ff308584c5bd3618d2e029de5bc5f5616f6b6e28489b99a2c10f7c8ecda067
data/README.md CHANGED
@@ -1,13 +1,13 @@
1
- # bxSlider Rails Gem - v4.2.4
1
+ # bxSlider Rails Gem - v4.2.5
2
2
 
3
- jQuery bxSlider v4.2.4 - http://bxslider.com
3
+ jQuery bxSlider v4.2.5 - http://bxslider.com
4
4
 
5
5
  bxSlider Author: Steven Wanderski, Copyright 2011
6
6
  bxslider-rails Author: Mauricio Natanael Ferreira.
7
7
 
8
8
  ### Extra info
9
9
 
10
- bxSlider 4.2.4 == bxslider-rails (4.2.4)
10
+ bxSlider 4.2.5 == bxslider-rails (4.2.5)
11
11
 
12
12
  ## Installation
13
13
 
@@ -1,5 +1,5 @@
1
1
  module Bxslider
2
2
  module Rails
3
- VERSION = "4.2.4"
3
+ VERSION = "4.2.5"
4
4
  end
5
5
  end
@@ -1,5 +1,5 @@
1
1
  /**
2
- * bxSlider v4.2.4
2
+ * bxSlider v4.2.5
3
3
  * Copyright 2013-2015 Steven Wanderski
4
4
  * Written while drinking Belgian ales and listening to jazz
5
5
 
@@ -346,10 +346,9 @@
346
346
  * Returns the calculated height of the viewport, used to determine either adaptiveHeight or the maxHeight value
347
347
  */
348
348
  var getViewportHeight = function() {
349
- var height = el.outerHeight(),
350
- currentIndex = null,
349
+ var height = 0;
351
350
  // first determine which children (slides) should be used in our height calculation
352
- children = $();
351
+ var children = $();
353
352
  // if mode is not "vertical" and adaptiveHeight is false, include all children
354
353
  if (slider.settings.mode !== 'vertical' && !slider.settings.adaptiveHeight) {
355
354
  children = slider.children;
@@ -360,14 +359,14 @@
360
359
  // if carousel, return a slice of children
361
360
  } else {
362
361
  // get the individual slide index
363
- currentIndex = slider.settings.moveSlides === 1 ? slider.active.index : slider.active.index * getMoveBy();
362
+ var currentIndex = slider.settings.moveSlides === 1 ? slider.active.index : slider.active.index * getMoveBy();
364
363
  // add the current slide to the children
365
364
  children = slider.children.eq(currentIndex);
366
365
  // cycle through the remaining "showing" slides
367
- for (var i = 1; i <= slider.settings.maxSlides - 1; i++) {
366
+ for (i = 1; i <= slider.settings.maxSlides - 1; i++) {
368
367
  // if looped back to the start
369
368
  if (currentIndex + i >= slider.children.length) {
370
- children = children.add(slider.children.eq(currentIndex + i - slider.children.length));
369
+ children = children.add(slider.children.eq(i - 1));
371
370
  } else {
372
371
  children = children.add(slider.children.eq(currentIndex + i));
373
372
  }
@@ -564,31 +563,39 @@
564
563
  if (type === 'slide') {
565
564
  // set the property value
566
565
  el.css(slider.animProp, propValue);
567
- // bind a callback method - executes when CSS transition completes
568
- el.bind('transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd', function(e) {
569
- //make sure it's the correct one
570
- if (!$(e.target).is(el)) { return; }
571
- // unbind the callback
572
- el.unbind('transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd');
566
+ if (duration !== 0) {
567
+ // bind a callback method - executes when CSS transition completes
568
+ el.bind('transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd', function(e) {
569
+ //make sure it's the correct one
570
+ if (!$(e.target).is(el)) { return; }
571
+ // unbind the callback
572
+ el.unbind('transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd');
573
+ updateAfterSlideTransition();
574
+ });
575
+ } else { //duration = 0
573
576
  updateAfterSlideTransition();
574
- });
577
+ }
575
578
  } else if (type === 'reset') {
576
579
  el.css(slider.animProp, propValue);
577
580
  } else if (type === 'ticker') {
578
581
  // make the transition use 'linear'
579
582
  el.css('-' + slider.cssPrefix + '-transition-timing-function', 'linear');
580
583
  el.css(slider.animProp, propValue);
581
- // bind a callback method - executes when CSS transition completes
582
- el.bind('transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd', function(e) {
583
- //make sure it's the correct one
584
- if (!$(e.target).is(el)) { return; }
585
- // unbind the callback
586
- el.unbind('transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd');
587
- // reset the position
584
+ if (duration !== 0) {
585
+ el.bind('transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd', function(e) {
586
+ //make sure it's the correct one
587
+ if (!$(e.target).is(el)) { return; }
588
+ // unbind the callback
589
+ el.unbind('transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd');
590
+ // reset the position
591
+ setPositionProperty(params.resetValue, 'reset', 0);
592
+ // start the loop again
593
+ tickerLoop();
594
+ });
595
+ } else { //duration = 0
588
596
  setPositionProperty(params.resetValue, 'reset', 0);
589
- // start the loop again
590
597
  tickerLoop();
591
- });
598
+ }
592
599
  }
593
600
  // use JS animate
594
601
  } else {
@@ -1281,6 +1288,34 @@
1281
1288
  }
1282
1289
  };
1283
1290
 
1291
+ /**
1292
+ * Returns index according to present page range
1293
+ *
1294
+ * @param slideOndex (int)
1295
+ * - the desired slide index
1296
+ */
1297
+ var setSlideIndex = function(slideIndex) {
1298
+ if (slideIndex < 0) {
1299
+ if (slider.settings.infiniteLoop) {
1300
+ return getPagerQty() - 1;
1301
+ }else {
1302
+ //we don't go to undefined slides
1303
+ return slider.active.index;
1304
+ }
1305
+ // if slideIndex is greater than children length, set active index to 0 (this happens during infinite loop)
1306
+ } else if (slideIndex >= getPagerQty()) {
1307
+ if (slider.settings.infiniteLoop) {
1308
+ return 0;
1309
+ } else {
1310
+ //we don't move to undefined pages
1311
+ return slider.active.index;
1312
+ }
1313
+ // set active index to requested slide
1314
+ } else {
1315
+ return slideIndex;
1316
+ }
1317
+ };
1318
+
1284
1319
  /**
1285
1320
  * ===================================================================================
1286
1321
  * = PUBLIC FUNCTIONS
@@ -1304,31 +1339,25 @@
1304
1339
  position = {left: 0, top: 0},
1305
1340
  lastChild = null,
1306
1341
  lastShowingIndex, eq, value, requestEl;
1342
+ // store the old index
1343
+ slider.oldIndex = slider.active.index;
1344
+ //set new index
1345
+ slider.active.index = setSlideIndex(slideIndex);
1307
1346
 
1308
1347
  // if plugin is currently in motion, ignore request
1309
- if (slider.working || slider.active.index === slideIndex) { return; }
1348
+ if (slider.working || slider.active.index === slider.oldIndex) { return; }
1310
1349
  // declare that plugin is in motion
1311
1350
  slider.working = true;
1312
- // store the old index
1313
- slider.oldIndex = slider.active.index;
1314
- // if slideIndex is less than zero, set active index to last child (this happens during infinite loop)
1315
- if (slideIndex < 0) {
1316
- slider.active.index = getPagerQty() - 1;
1317
- // if slideIndex is greater than children length, set active index to 0 (this happens during infinite loop)
1318
- } else if (slideIndex >= getPagerQty()) {
1319
- slider.active.index = 0;
1320
- // set active index to requested slide
1321
- } else {
1322
- slider.active.index = slideIndex;
1323
- }
1324
1351
 
1325
1352
  performTransition = slider.settings.onSlideBefore.call(el, slider.children.eq(slider.active.index), slider.oldIndex, slider.active.index);
1326
1353
 
1354
+ // If transitions canceled, reset and return
1327
1355
  if (typeof (performTransition) !== 'undefined' && !performTransition) {
1328
1356
  slider.active.index = slider.oldIndex; // restore old index
1329
1357
  slider.working = false; // is not in motion
1330
1358
  return;
1331
1359
  }
1360
+
1332
1361
  if (direction === 'next') {
1333
1362
  // Prevent canceling in future functions or lack there-of from negating previous commands to cancel
1334
1363
  if (!slider.settings.onSlideNext.call(el, slider.children.eq(slider.active.index), slider.oldIndex, slider.active.index)) {
@@ -1341,13 +1370,6 @@
1341
1370
  }
1342
1371
  }
1343
1372
 
1344
- // If transitions canceled, reset and return
1345
- if (typeof (performTransition) !== 'undefined' && !performTransition) {
1346
- slider.active.index = slider.oldIndex; // restore old index
1347
- slider.working = false; // is not in motion
1348
- return;
1349
- }
1350
-
1351
1373
  // check if last slide
1352
1374
  slider.active.last = slider.active.index >= getPagerQty() - 1;
1353
1375
  // update the pager with active class
@@ -1399,7 +1421,8 @@
1399
1421
  slider.active.last = false;
1400
1422
  // normal non-zero requests
1401
1423
  } else if (slideIndex >= 0) {
1402
- requestEl = slideIndex * getMoveBy();
1424
+ //parseInt is applied to allow floats for slides/page
1425
+ requestEl = slideIndex * parseInt(getMoveBy());
1403
1426
  position = slider.children.eq(requestEl).position();
1404
1427
  }
1405
1428
 
@@ -1407,10 +1430,12 @@
1407
1430
  * (e.g. if you destroy the slider on a next click),
1408
1431
  * it doesn't throw an error.
1409
1432
  */
1410
- if (typeof (position) !== undefined) {
1433
+ if (typeof (position) !== 'undefined') {
1411
1434
  value = slider.settings.mode === 'horizontal' ? -(position.left - moveBy) : -position.top;
1412
1435
  // plugin values to be animated
1413
1436
  setPositionProperty(value, 'slide', slider.settings.speed);
1437
+ } else {
1438
+ slider.working = false;
1414
1439
  }
1415
1440
  }
1416
1441
  if (slider.settings.ariaHidden) { applyAriaHiddenAttributes(slider.active.index * getMoveBy()); }
@@ -1,5 +1,5 @@
1
1
  /**
2
- * bxSlider v4.2.4
2
+ * bxSlider v4.2.5
3
3
  * Copyright 2013-2015 Steven Wanderski
4
4
  * Written while drinking Belgian ales and listening to jazz
5
5
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bxslider-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.2.4
4
+ version: 4.2.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mauricio N. Ferreira