Skip to content

Commit

Permalink
Merge pull request #2504 from SUI-Components/fix/infiniteLopp-mobile
Browse files Browse the repository at this point in the history
fix(components/molecule/carousel): fix infiniteLoop onTouchEnd event
  • Loading branch information
sergiqm94 authored Jan 26, 2023
2 parents 70a13a1 + d67a00c commit 0e1c68f
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions components/molecule/carousel/src/slidy.js
Original file line number Diff line number Diff line change
Expand Up @@ -185,13 +185,15 @@ export default function slidy(containerDOMEl, options) {
(direction === true && index === items - 1)

/**
* If the swipe is valid and we're not out of bounds
* If the swipe is valid and we're not out of bounds or is infiniteLoop
* -> Slide to the direction
* otherwise: go back to the previous slide with a linear animation
*/
isValid === true && isOutOfBounds === false
? slide(direction)
: _translate(slideSpeed, LINEAR_ANIMATION)
if (isValid === true && (isOutOfBounds === false || infiniteLoop)) {
slide(direction)
} else {
_translate(slideSpeed, LINEAR_ANIMATION)
}
}

// reset variables with the initial values
Expand Down

0 comments on commit 0e1c68f

Please sign in to comment.