Skip to content

Commit

Permalink
[ bugfix 2055 ]
Browse files Browse the repository at this point in the history
- error with the handling on slider refresh
- happens when going to a breakpoint with more slides to show than actual
  slides.
- fixed bad condition structure.

fixes kenwheeler#2055
  • Loading branch information
simeydotme committed Jan 25, 2016
1 parent ae0fcfb commit 3f16928
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions slick/slick.js
Original file line number Diff line number Diff line change
Expand Up @@ -1635,22 +1635,22 @@

Slick.prototype.refresh = function( initializing ) {

var _ = this, currentSlide, firstVisible;

firstVisible = _.slideCount - _.options.slidesToShow;

// check that the new breakpoint can actually accept the
// "current slide" as the current slide, otherwise we need
// to set it to the closest possible value.
if ( !_.options.infinite ) {
if ( _.slideCount <= _.options.slidesToShow ) {
_.currentSlide = 0;
} else if ( _.currentSlide > firstVisible ) {
_.currentSlide = firstVisible;
}
var _ = this, currentSlide, lastVisibleIndex;

lastVisibleIndex = _.slideCount - _.options.slidesToShow;

// in non-infinite sliders, we don't want to go past the
// last visible index.
if( !_.options.infinite && ( _.currentSlide > lastVisibleIndex )) {
_.currentSlide = lastVisibleIndex;
}

// if less slides than to show, go to start.
if ( _.slideCount <= _.options.slidesToShow ) {
_.currentSlide = 0;
}

currentSlide = _.currentSlide;
currentSlide = _.currentSlide;

_.destroy(true);

Expand Down

0 comments on commit 3f16928

Please sign in to comment.