Skip to content

Commit

Permalink
Merge pull request #2329 from rjsdnql123/fix/element-slidesToShow-sam…
Browse files Browse the repository at this point in the history
…e-value

Fix: If the element (DOM element) and the value of 'slidesToShow' are…
  • Loading branch information
akiran authored Jan 24, 2024
2 parents d91bb58 + 3669b0a commit 15d93c5
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/slider.js
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ export default class Slider extends React.Component {
if (settings === "unslick") {
const className = "regular slider " + (this.props.className || "");
return <div className={className}>{children}</div>;
} else if (newChildren.length <= settings.slidesToShow) {
} else if (newChildren.length <= settings.slidesToShow && !settings.infinite) {
settings.unslick = true;
}
return (
Expand Down
5 changes: 1 addition & 4 deletions src/track.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,7 @@ const renderSlides = spec => {
if (spec.infinite && spec.fade === false) {
let preCloneNo = childrenCount - index;
if (
preCloneNo <= getPreClones(spec) &&
childrenCount !== spec.slidesToShow
preCloneNo <= getPreClones(spec)
) {
key = -preCloneNo;
if (key >= startIndex) {
Expand All @@ -164,7 +163,6 @@ const renderSlides = spec => {
);
}

if (childrenCount !== spec.slidesToShow) {
key = childrenCount + index;
if (key < endIndex) {
child = elem;
Expand All @@ -186,7 +184,6 @@ const renderSlides = spec => {
}
})
);
}
}
});

Expand Down

0 comments on commit 15d93c5

Please sign in to comment.