Repository navigation
SummaryWhen using the Auto Scroll plugin with If applicable, which variants of Embla Carousel are relevant to this question?
Additional informationconst plugins = computed(() => {
const basePlugins = [
ClassNames(),
]
if (props.autoScroll) {
basePlugins.push(AutoScroll({
speed: 1,
defaultInteraction: false,
}))
}
return basePlugins
})
const [viewport, embla] = emblaCarouselVue({
loop: props.autoScroll ? true : false,
align: 'start',
dragFree: true,
}, plugins.value) |
Replies: 1 comment
|
In the Auto Scroll source, So if you want auto-scroll to continue after a drag, you need to restart it yourself after the drag settles, for example by calling the plugin API: emblaApi.plugins().autoScroll?.play(0)Do that from your |
defaultInteraction: falseonly changes what the Auto Scroll plugin does on interaction. It does not make Embla's normal drag interaction invisible to the carousel.In the Auto Scroll source,
defaultInteraction: truemaps interaction events toonDefaultInteraction(), which stops onpointerdown/slidefocus. WithdefaultInteraction: false, the plugin usesonCustomInteraction()instead. That custom handler only recordsisPointerDown/isMouseOverand emitsautoscroll:interaction; it does not automatically callplay()again after the drag.So if you want auto-scroll to continue after a drag, you need to restart it yourself after the drag settles, for example by calling the plugin API: