Skip to content

Commit

Permalink
Merge pull request kenwheeler#2118 from engelfrost/master
Browse files Browse the repository at this point in the history
Center even number of horizontal slides when centerMode is true
  • Loading branch information
leggomuhgreggo authored Sep 16, 2016
2 parents 6db519a + f96171e commit a737a4c
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion slick/slick.js
Original file line number Diff line number Diff line change
Expand Up @@ -1102,7 +1102,9 @@
verticalOffset = 0;
}

if (_.options.centerMode === true && _.options.infinite === true) {
if (_.options.centerMode === true && _.slideCount <= _.options.slidesToShow) {
_.slideOffset = ((_.slideWidth * Math.floor(_.options.slidesToShow)) / 2) - ((_.slideWidth * _.slideCount) / 2);
} else if (_.options.centerMode === true && _.options.infinite === true) {
_.slideOffset += _.slideWidth * Math.floor(_.options.slidesToShow / 2) - _.slideWidth;
} else if (_.options.centerMode === true) {
_.slideOffset = 0;
Expand Down

0 comments on commit a737a4c

Please sign in to comment.