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">
<div class="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>
<script setup>
const avatarArray = [
'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.
You can use the animateOnOverflowOnly prop to animate the marquee only when the content overflows the container. You can adjust the size of the window to see the effect.
This prop does not work with vertical marquee animations. Since a fixed height parent container is required for vertical animations, this feature is not supported.
The animation snaps back to the start when the content overflow is resolved. You can use the justify-content css property to control the alignment of the content in this instance.
You could try this system for items like stock tickers for a static on start but adding on more items as the content grows. This could also work for music players where the song title is displayed. The animation would only start when the song title is too long to fit in the container.
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.