Skip to content

Commit

Permalink
fix(carousel): considered offset page start
Browse files Browse the repository at this point in the history
  • Loading branch information
IgnacioBecerra committed Feb 22, 2021
1 parent ccc6d46 commit 6c91211
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/web-components/src/components/carousel/carousel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,10 @@ class DDSCarousel extends HostListenerMixin(LitElement) {
if (currentContains) {
// going forwards, change page depending on card index
if (currentCardIndex >= this.start + this.pageSize) {
this.start = currentCardIndex - (currentCardIndex % this.pageSize);
const nextStart = currentCardIndex - (currentCardIndex % this.pageSize);
const pageOffset = this.start % this.pageSize;

this.start = nextStart + pageOffset;

// going backwards, change page depending on card index
} else if (currentCardIndex < this.start) {
Expand Down

0 comments on commit 6c91211

Please sign in to comment.