Permalink
Browse files

Make sure currentSlide is a number

Make sure that currentSlide is a number and not a string. If it is a
string like '1', FlexSlider will start appending instead of doing the
correct calculations.
  • Loading branch information...
1 parent f4197a0 commit 751945508bbc5480df48088ee58f5ffd7f5a18f8 @tiagonoronha tiagonoronha committed Apr 1, 2013
Showing with 3 additions and 1 deletion.
  1. +3 −1 jquery.flexslider.js
View
@@ -35,7 +35,9 @@
methods = {
init: function() {
slider.animating = false;
- slider.currentSlide = slider.vars.startAt;
+ // Get current slide and make sure it is a number
+ slider.currentSlide = parseInt( ( slider.vars.startAt ? slider.vars.startAt : 0) );
+ if ( isNaN( slider.currentSlide ) ) slider.currentSlide = 0;
slider.animatingTo = slider.currentSlide;
slider.atEnd = (slider.currentSlide === 0 || slider.currentSlide === slider.last);
slider.containerSelector = slider.vars.selector.substr(0,slider.vars.selector.search(' '));

0 comments on commit 7519455

Please sign in to comment.