Embla Autoplay hinzugefügt

This commit is contained in:
R40fendt
2025-04-16 19:24:03 +02:00
parent ad8ce7fb67
commit 05d18106b5

View File

@@ -8,17 +8,30 @@ const emblaApi = ref();
const [emblaRef, emblaInstance] = emblaCarouselVue({ loop: true });
let timeout=false;
onMounted(() => {
emblaApi.value = emblaInstance.value;
setInterval(()=>{
if(!timeout) emblaApi.value?.scrollNext();
}, 2000);
});
const prev = () => {
emblaApi.value?.scrollPrev();
addTimeout();
};
const next = () => {
emblaApi.value?.scrollNext();
addTimeout();
};
function addTimeout(){
timeout=true;
setTimeout(()=>{
timeout=false;
}, 4000);
}
defineProps({
src: {