<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>
constavatarArray= [
'https://avatars.dicebear.com/api/avataaars/1.svg',
'https://avatars.dicebear.com/api/avataaars/2.svg',
'https://avatars.dicebear.com/api/avataaars/3.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>
constavatarArray= [
'https://avatars.dicebear.com/api/avataaars/1.svg',
'https://avatars.dicebear.com/api/avataaars/2.svg',
'https://avatars.dicebear.com/api/avataaars/3.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.
With this component you can also create a vertical marquee. This is useful if you want to create a vertical scrolling list of items.
You will need to put your marquee inside a parent container with a defined height. You can also use a fixed width if you want to limit the width of the marquee. The marquee component will otherwise take up the full width of the parent container.
Vertical marquees are still experimental. All props and events are supported, but there may be some bugs. Please open an issue if you find any.
All props (including clone) and events are supported for vertical marquees. The only difference is that the vertical prop needs to be set to true.
If your marquee content is too small to take the width of the full container it will leave an empty space.
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.