vue3-carousel icon indicating copy to clipboard operation
vue3-carousel copied to clipboard

There is a way to intercept carousel navigation changes?

Open gsmeira opened this issue 3 years ago • 2 comments

Is your feature request related to a problem? Please describe. It's not a problem. I just want more flexibility to tweak some custom behaviors I have in my use case.

Describe the solution you'd like I would like a way to add a callback function to be called every time a navigation happen in the carousel.

Describe alternatives you've considered Maybe a new prop in the <Carousel /> component to pass a callback function that receive as arguments the next and previous slide.

gsmeira avatar Jan 20 '22 21:01 gsmeira

This would be super useful to be able to listen to an event called @change for example, so I know the current index value of the carousel.

leifriksheim avatar Jan 31 '22 11:01 leifriksheim

Hi there,

On mobile when you are scrolling on the page and you scroll down the page over the carousel it changes the slide and It would be great to have something like that to intercept this behavior.

Regards

franco-onevillas avatar Feb 02 '22 21:02 franco-onevillas

Use case: I need to load some content on the slide only when it becomes visible (or close to be visible). The ideal would be to have a @change event as suggested by @leifriksheim, ex:

<carousel @change="changed">
  <slide>toto</slide>
  <slide>titi</slide>
  <slide>tata</slide>
</carousel>
//...
methods: {
  //...
  changed(page, event) {
    console.log('Carousel is showing the page:', page);
    console.log('Direction', event.direction);
    console.log('Previous slide index', event.previousSlideIndex);
    console.log('Change type', event.changeType); // touch|navigation|api
  },
},

Other events would be useful too:

  • @slide-start
  • @slide-end
  • @loop (just cycled)

And maybe some events directly on a specific slide:

  • @enter
  • @leave

Glideh avatar Nov 24 '22 09:11 Glideh