Skip to content

Commit

Permalink
fix: sync slides after complete initialization
Browse files Browse the repository at this point in the history
  • Loading branch information
alenaksu authored Nov 5, 2024
1 parent 8db6580 commit 25c8169
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions docs/pages/components/carousel.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ layout: component
---

```html:preview
<sl-resize-observer>
<sl-carousel pagination navigation mouse-dragging loop>
<sl-carousel-item>
<img
Expand Down Expand Up @@ -38,6 +39,7 @@ layout: component
/>
</sl-carousel-item>
</sl-carousel>
</sl-resize-observer>
```

```jsx:react
Expand Down
4 changes: 2 additions & 2 deletions src/components/carousel/carousel.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -381,10 +381,10 @@ export default class SlCarousel extends ShoelaceElement {
this.createClones();
}

this.synchronizeSlides();

// Because the DOM may be changed, restore the scroll position to the active slide
this.goToSlide(this.activeSlide, 'auto');

this.synchronizeSlides();
}

private createClones() {
Expand Down

0 comments on commit 25c8169

Please sign in to comment.