Skip to content

Commit

Permalink
Merge pull request kenwheeler#2068 from simeydotme/bugfix-2055
Browse files Browse the repository at this point in the history
[ bugfix 2055 ]
  • Loading branch information
simeydotme committed Jan 25, 2016
2 parents 66489de + f817464 commit 15ac6a4
Showing 1 changed file with 15 additions and 14 deletions.
29 changes: 15 additions & 14 deletions slick/slick.js
Original file line number Diff line number Diff line change
Expand Up @@ -1635,22 +1635,23 @@

Slick.prototype.refresh = function( initializing ) {

var _ = this, currentSlide, firstVisible;

firstVisible = Math.floor(_.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 15ac6a4

Please sign in to comment.