Skip to content

Instantly share code, notes, and snippets.

@biyootiful
Created December 1, 2017 20:02
Show Gist options
  • Save biyootiful/a20a8be47d936a641d3355761bda2021 to your computer and use it in GitHub Desktop.
Save biyootiful/a20a8be47d936a641d3355761bda2021 to your computer and use it in GitHub Desktop.
slideLeft(index) {
const { catWidth } = this.state;
let slideTo = 0;
for (let i = 0; i < index; i++) {
slideTo += catWidth[i] + 40;
}
this.setState({
toLeft: slideTo * -1 + 40,
currentSlideIndex: index,
currentItem: 0
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment