Skip to content

Commit af77fc2

Browse files
committed
Updated files to version 4.2.5
1 parent e9eba7a commit af77fc2

File tree

4 files changed

+75
-50
lines changed

4 files changed

+75
-50
lines changed

README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
# bxSlider Rails Gem - v4.2.4
1+
# bxSlider Rails Gem - v4.2.5
22

3-
jQuery bxSlider v4.2.4 - http://bxslider.com
3+
jQuery bxSlider v4.2.5 - http://bxslider.com
44

55
bxSlider Author: Steven Wanderski, Copyright 2011
66
bxslider-rails Author: Mauricio Natanael Ferreira.
77

88
### Extra info
99

10-
bxSlider 4.2.4 == bxslider-rails (4.2.4)
10+
bxSlider 4.2.5 == bxslider-rails (4.2.5)
1111

1212
## Installation
1313

lib/bxslider-rails/version.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
module Bxslider
22
module Rails
3-
VERSION = "4.2.4"
3+
VERSION = "4.2.5"
44
end
55
end

vendor/assets/javascripts/jquery.bxslider.js

+70-45
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* bxSlider v4.2.4
2+
* bxSlider v4.2.5
33
* Copyright 2013-2015 Steven Wanderski
44
* Written while drinking Belgian ales and listening to jazz
55
@@ -346,10 +346,9 @@
346346
* Returns the calculated height of the viewport, used to determine either adaptiveHeight or the maxHeight value
347347
*/
348348
var getViewportHeight = function() {
349-
var height = el.outerHeight(),
350-
currentIndex = null,
349+
var height = 0;
351350
// first determine which children (slides) should be used in our height calculation
352-
children = $();
351+
var children = $();
353352
// if mode is not "vertical" and adaptiveHeight is false, include all children
354353
if (slider.settings.mode !== 'vertical' && !slider.settings.adaptiveHeight) {
355354
children = slider.children;
@@ -360,14 +359,14 @@
360359
// if carousel, return a slice of children
361360
} else {
362361
// 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();
364363
// add the current slide to the children
365364
children = slider.children.eq(currentIndex);
366365
// 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++) {
368367
// if looped back to the start
369368
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));
371370
} else {
372371
children = children.add(slider.children.eq(currentIndex + i));
373372
}
@@ -564,31 +563,39 @@
564563
if (type === 'slide') {
565564
// set the property value
566565
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
573576
updateAfterSlideTransition();
574-
});
577+
}
575578
} else if (type === 'reset') {
576579
el.css(slider.animProp, propValue);
577580
} else if (type === 'ticker') {
578581
// make the transition use 'linear'
579582
el.css('-' + slider.cssPrefix + '-transition-timing-function', 'linear');
580583
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
588596
setPositionProperty(params.resetValue, 'reset', 0);
589-
// start the loop again
590597
tickerLoop();
591-
});
598+
}
592599
}
593600
// use JS animate
594601
} else {
@@ -1281,6 +1288,34 @@
12811288
}
12821289
};
12831290

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+
12841319
/**
12851320
* ===================================================================================
12861321
* = PUBLIC FUNCTIONS
@@ -1304,31 +1339,25 @@
13041339
position = {left: 0, top: 0},
13051340
lastChild = null,
13061341
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);
13071346

13081347
// 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; }
13101349
// declare that plugin is in motion
13111350
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-
}
13241351

13251352
performTransition = slider.settings.onSlideBefore.call(el, slider.children.eq(slider.active.index), slider.oldIndex, slider.active.index);
13261353

1354+
// If transitions canceled, reset and return
13271355
if (typeof (performTransition) !== 'undefined' && !performTransition) {
13281356
slider.active.index = slider.oldIndex; // restore old index
13291357
slider.working = false; // is not in motion
13301358
return;
13311359
}
1360+
13321361
if (direction === 'next') {
13331362
// Prevent canceling in future functions or lack there-of from negating previous commands to cancel
13341363
if (!slider.settings.onSlideNext.call(el, slider.children.eq(slider.active.index), slider.oldIndex, slider.active.index)) {
@@ -1341,13 +1370,6 @@
13411370
}
13421371
}
13431372

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-
13511373
// check if last slide
13521374
slider.active.last = slider.active.index >= getPagerQty() - 1;
13531375
// update the pager with active class
@@ -1399,18 +1421,21 @@
13991421
slider.active.last = false;
14001422
// normal non-zero requests
14011423
} else if (slideIndex >= 0) {
1402-
requestEl = slideIndex * getMoveBy();
1424+
//parseInt is applied to allow floats for slides/page
1425+
requestEl = slideIndex * parseInt(getMoveBy());
14031426
position = slider.children.eq(requestEl).position();
14041427
}
14051428

14061429
/* If the position doesn't exist
14071430
* (e.g. if you destroy the slider on a next click),
14081431
* it doesn't throw an error.
14091432
*/
1410-
if (typeof (position) !== undefined) {
1433+
if (typeof (position) !== 'undefined') {
14111434
value = slider.settings.mode === 'horizontal' ? -(position.left - moveBy) : -position.top;
14121435
// plugin values to be animated
14131436
setPositionProperty(value, 'slide', slider.settings.speed);
1437+
} else {
1438+
slider.working = false;
14141439
}
14151440
}
14161441
if (slider.settings.ariaHidden) { applyAriaHiddenAttributes(slider.active.index * getMoveBy()); }

vendor/assets/stylesheets/bxslider.css.scss

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* bxSlider v4.2.4
2+
* bxSlider v4.2.5
33
* Copyright 2013-2015 Steven Wanderski
44
* Written while drinking Belgian ales and listening to jazz
55

0 commit comments

Comments
 (0)