vue-ssr-carousel
vue-ssr-carousel copied to clipboard
init / destroy methods
Great piece of work! I was wondering how to init / destroy carousel on specific breakpoints as there are no such methods in the documentation. Would appreciate help. Thanks!
Thank you!
Can you tell me more about your use case?
If you check out the first example on https://vue-ssr-carousel.netlify.app/misc, it disables the carousel-ness when there aren't enough slides for the slides-per-page
of your current breakpoint. I'm wondering, in particular, if that feature will fit your needs or not.
I would need exactly opposite behavior (disabled on mobile, active on desktop). But this is not the point. The point is to be able to programmatically init/destroy carousel. For example like this: https://flickity.metafizzy.co/api.html#destroy (manually) or https://splidejs.com/guides/options/#destroy (with breakpoints)
I still don't understand why you would need to init or destroy manually.
Also, such an API doesn't feel very Vue-y to me. Like if you don't want to use vue-ssr-carousel at some breakpoint, I think you would just wrap it in a v-if
that is bound to some variable you update based on the window width.
True, but with v-if you would loose the markup. Manually destroy for a scenario when you do not want a carousel but a set of static element.