Skip to content

Commit

Permalink
correct dot count for infinite: false
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeseeq committed Dec 3, 2018
1 parent 60f3694 commit d5f0467
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions src/dots.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,20 @@
import React from "react";
import classnames from "classnames";

var getDotCount = function(spec) {
var getDotCount = function({
infinite,
slideCount,
slidesToScroll,
slidesToShow
}) {
var dots;

if (spec.infinite) {
dots = Math.ceil(spec.slideCount / spec.slidesToScroll);
if (infinite) {
dots = Math.ceil(slideCount / slidesToScroll);
} else if (slidesToScroll > 1) {
dots = Math.ceil((slideCount - slidesToShow) / slidesToScroll) + 1;
} else {
dots =
Math.ceil((spec.slideCount - spec.slidesToShow) / spec.slidesToScroll) +
1;
dots = Math.ceil(slideCount);
}

return dots;
Expand Down

0 comments on commit d5f0467

Please sign in to comment.