Skip to content
New issue

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

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

Already on GitHub? # to your account

Event pageChange not implemented in Carouse.svelte #94

Closed
manuthinkcoconut opened this issue Feb 10, 2022 · 1 comment
Closed

Event pageChange not implemented in Carouse.svelte #94

manuthinkcoconut opened this issue Feb 10, 2022 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@manuthinkcoconut
Copy link

Hi, great job man!!

I have seen that pageChange does not fire the event.
I did not see it implemented in Carousel.svelte, it does work when clicking on DOTS, but not with SWIPE

I have solved it for myself, putting the dispatch in these functions:

DOTS

async function handlePageChange(pageIndex) {
    dispatch('pageChange', pageIndex)
    await methods.showPage(pageIndex, { animated: true })
  }

SWIPE

  async function handleSwipeThresholdReached(event) {
    if (!swiping) return
    await switcher({
      [NEXT]: methods.showNextPage,
      [PREV]: methods.showPrevPage
    })(event.detail.direction)
    dispatch('pageChange', currentPageIndex)
  }

THANKS!!!

vadimkorr added a commit that referenced this issue May 4, 2022
@vadimkorr vadimkorr added the bug Something isn't working label May 4, 2022
@vadimkorr vadimkorr self-assigned this May 4, 2022
vadimkorr added a commit that referenced this issue May 5, 2022
…ange-event

#94 Fix dispatching pageChange event
@vadimkorr
Copy link
Owner

Release 1.0.19

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants