<template>
<Vue3Marquee>
<divclass="card"v-for="avatar in avatarArray":key="avatar">
<img:src="avatar" />
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua.
</p>
</div>
</Vue3Marquee>
</template>
<scriptsetup>
import'vue3-marquee/dist/style.css'
constavatarArray=reactive([])
for (let i =0; i <5; i++) {
avatarArray.push(
`https://avatars.dicebear.com/api/avataaars/${Math.random()
.toString(36)
.substr(2, 6)}.svg`
)
}
</script>
The marquee can pause when you hover over the content. This is useful if you want the ability to run additional actions inside the content. For this example the pauseOnHover prop is used.
<template>
<Vue3Marquee:pause-on-hover="true">
<divclass="card"v-for="avatar in avatarArray":key="avatar">
<img:src="avatar" />
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua.
</p>
</div>
</Vue3Marquee>
</template>
<scriptsetup>
import'vue3-marquee/dist/style.css'
constavatarArray=reactive([])
for (let i =0; i <5; i++) {
avatarArray.push(
`https://avatars.dicebear.com/api/avataaars/${Math.random()
.toString(36)
.substr(2, 6)}.svg`
)
}
</script>
You can also use the right click button to momentarily pause the animation. Hold the right click button to pause the animation. Releasing the mouse button will resume the animation. In this example the pauseOnClick prop is used.
If you need more functionality than this, using a carousel component might be better for your use case. Two that I would suggest are the vue3-carousel or egjs/vue-flicking.
If your marquee content is too small to take the width of the full container it will leave an empty space.
This feature is still experimental. If you have any issues with this option I would suggest you to have content that is wider than your container or make a duplicate of the content if possible.
You can use the clone prop to workaround this issue. With this option, vue3-marquee will automatically calculate the content and container widths and clone your content to fill the container completely.
This option is also responsive to the container width. If you resize the window, the content will be cloned again to fill the container.