Skip to content

Commit

Permalink
fix: infinite sliding in Slider component with center option set to true
Browse files Browse the repository at this point in the history
  • Loading branch information
janschoenherr committed Feb 7, 2022
1 parent e3a0188 commit ec95eb0
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ WIP

### Fixed

- Fix infinite sliding in Slider component with 3 equally sized slides and center option set to true
- Fix infinite sliding in Slider component with center option set to true

## 3.11.1 (February 7, 2022)

Expand Down
4 changes: 2 additions & 2 deletions src/js/components/slider.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export default {
},

finite({finite}) {
return finite || Math.ceil(getWidth(this.list)) < dimensions(this.list).width + getMaxElWidth(this.list);
return finite || Math.ceil(getWidth(this.list)) < Math.floor(dimensions(this.list).width + getMaxElWidth(this.list));
},

maxIndex() {
Expand Down Expand Up @@ -212,7 +212,7 @@ export default {
let width = dimensions(this.list).width / 2 - dimensions(next).width / 2;
let j = 0;

while (width > 0) {
while (Math.floor(width) > 0) {
const slideIndex = this.getIndex(--j + index, index);
const slide = this.slides[slideIndex];

Expand Down

0 comments on commit ec95eb0

Please sign in to comment.