Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feat]: Trigger event (autoplay:select) on autoplay index update #1054

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Implement #1048.
  • Loading branch information
Mitch-At-Work committed Nov 8, 2024
commit 71a5d4775b1b2c368aeb727753dbb94c0cb25196
3 changes: 3 additions & 0 deletions packages/embla-carousel-autoplay/src/components/Autoplay.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ declare module 'embla-carousel' {
interface EmblaEventListType {
autoplayPlay: 'autoplay:play'
autoplayStop: 'autoplay:stop'
autoplaySelect: 'autoplay:select'
}
}

Expand Down Expand Up @@ -165,6 +166,8 @@ function Autoplay(userOptions: AutoplayOptionsType = {}): AutoplayType {
} else {
emblaApi.scrollTo(0, jump)
}

emblaApi.emit('autoplay:select')
}

const self: AutoplayType = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,3 +193,11 @@ Once: <BrandPrimaryText>`no`</BrandPrimaryText>
Fires when autoplay stops playing.

---

### autoplay:select

Once: <BrandPrimaryText>`no`</BrandPrimaryText>

Fires directly after autoplay selects a new index.

---