Skip to content

Commit

Permalink
Fix overlapping issue when loop with 2 frames. #113
Browse files Browse the repository at this point in the history
  • Loading branch information
amio committed Oct 24, 2018
1 parent 50fec7e commit 1b86bae
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/carousel.js
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,19 @@ class Carousel extends React.Component {

prev () {
if (!this.props.loop && this.state.current === 0) return false
const { prev, next } = this.state.movingFrames

if (prev === next) {
// Reprepare start position of prev frame
// (it was positioned as "next" frame)
if (this.props.axis === 'x') {
translateXY(prev, -this.state.frameWidth, 0, 0)
} else {
translateXY(prev, 0, -this.state.frameHeight, 0)
}
prev.getClientRects() // trigger layout
}

this.autoSlide('prev')
}

Expand Down

0 comments on commit 1b86bae

Please sign in to comment.