Code Monkey home page Code Monkey logo

vue3-marquee's Introduction

vue3-marquee

npm Downloads Stars License GitHub issues

A simple marquee component with ZERO dependencies for Vue 3. This component was originally developed for internal use but I figured this could be useful to someone else as well. This component is modeled after a React marquee component I found called React Fast Marquee. To keep a smooth animation running, clones of the content can be created for seamless transitions with no flickering or empty spaces in between content.

Demos

View the live demos here: https://vue3-marquee.vercel.app/examples

Upgrade to v4.x

If you are using version 3.x of vue3-marquee you should upgrade to version 4.x. You can do this by running the Installation and Usage command below. This add better support for Typescript. There is also a change with the dist/style.css import (it's been removed) so take a look at the new documentation for instructions on how to migrate to this package.

Installation and Usage

Vue 3

If you are using npm:

npm install vue3-marquee@latest --save

If you are using yarn:

yarn add vue3-marquee@latest
  • Register the component in your Vue 3 application.

The most common use case is to register the component globally.

// main.js
import { createApp } from 'vue'
import Vue3Marquee from 'vue3-marquee'

createApp(App).use(Vue3Marquee).mount('#app')

If you need to use a custom component name, you can pass it as an option to the plugin:

app.use(Vue3Marquee, { name: 'MarqueeAnimation' }) // use in template <MarqueeAnimation />
  • name string (default: 'Vue3Marquee') - set custom component name

Alternatively you can also import the component locally.

import { Vue3Marquee } from 'vue3-marquee'

export default {
  components: {
    Vue3Marquee,
  },
}

You can then use the component in your template

<template>
  <Vue3Marquee>
    <img height="200" width="300" src="...img" />
    <img height="200" width="300" src="...img" />
    <img height="200" width="300" src="...img" />
  </Vue3Marquee>
</template>

<script>
import { Vue3Marquee } from 'vue3-marquee'

export default {
  components: {
    Vue3Marquee,
  },
}
</script>

Nuxt 3

If you are using npm:

npm install vue3-marquee@latest --save

If you are using yarn:

yarn add vue3-marquee@latest
  • Create a folder called plugins at the root of your project.
  • Create a file named Vue3Marquee.client.ts inside the plugins directory.
  • Add the following code to the Vue3Marquee.client.ts file.
import Vue3Marquee from 'vue3-marquee'

export default defineNuxtPlugin((nuxtApp) => {
  nuxtApp.vueApp.use(Vue3Marquee, { name: 'Vue3Marquee' })
})

This should register as a global component that you can call anywhere in your app under the <Vue3Marquee> tag.

Props and options

More detailed explanations are provided in the documentation.

Prop Type Default Value Description
direction String of either 'normal' or 'reverse' "normal" The direction for the content to move in
duration Number 20 The time taken for the marquee content to move the width of the container (in seconds)
delay Number 0 A delay before the animation starts (in seconds)
loop Number 0 The number of instances that the marquee animation should run (0 is infinite)
gradient Boolean false Whether to show a gradient overlay
gradientColor Array of 3 RGB values [255, 255, 255] The RGB colors for the color of the gradient
gradientLength String 200px Length of portion of the container edges that should be taken by the gradient overlay
pause Boolean false A reactive prop to pause the marquee
pauseOnHover Boolean false Whether to pause the marquee on hover
pauseOnClick Boolean false Whether to pause the marquee when you hold the right click button
clone Boolean false Whether to clone the content if you want no empty spaces in the animation
vertical Boolean false Whether to make the marquee vertical
animateOnOverflowOnly Boolean false Whether to animate the marquee if the content overflows the container

Events

A few events are emitted from the component. Look at the Demos for examples.

  • onComplete
    • If your marquee has a finite amount of loops you can use this event to know when the animation has completed.
  • onLoopComplete
    • You can use this event to know when your marquee has completed a loop.
  • onPause
    • This event is emitted if you have either pauseOnHover or pauseOnClick enabled. It will notify if the animation pauses.
  • onResume
    • This event is emitted if you have either pauseOnHover or pauseOnClick enabled. It will notify if the animation resumes.
  • onOverflowDetected
    • This event is emitted if you have animateOnOverflowOnly enabled. It will notify if the content overflows the container.
  • onOverflowCleared
    • This event is emitted if you have animateOnOverflowOnly enabled. It will notify if the content no longer overflows the container. (useful if you need to add a class to the container when the content overflows)

Credits

forthebadge forthebadge

vue3-marquee's People

Contributors

dependabot[bot] avatar durss avatar imgbot[bot] avatar krishnaguragain avatar lint-action avatar luisrondow avatar megasanjay avatar renovate-bot avatar renovate[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

vue3-marquee's Issues

PC/WEB can be used, Uniapp unavailable,Cannot auto scroll

Describe the bug
A clear and concise description of what the bug is.

To Reproduce
Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: [e.g. iOS]
  • Browser [e.g. chrome, safari]
  • Version [e.g. 22]

Smartphone (please complete the following information):

  • Device: [e.g. iPhone6]
  • OS: [e.g. iOS8.1]
  • Browser [e.g. stock browser, safari]
  • Version [e.g. 22]

Additional context
Add any other context about the problem here.

reverse is not doing great

Describe the bug
when reverse is set to true, the text instead of lopping it then just stops when the loop completes and starts over, however this is not the same case with 'normal'.

To Reproduce
Steps to reproduce the behavior:

    <Vue3Marquee :duration="7" :direction="dir == 'rtl' ? 'reverse' : 'normal'">
       This is English text but it is gonna be in arabic sometime
    </Vue3Marquee>

Expected behavior
Should work exactly as normal but in reverse.

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: Debian 12
  • Browser FireFox
  • Version 122.0.1

Smartphone (please complete the following information):

  • Device: [e.g. iPhone6]
  • OS: [e.g. iOS8.1]
  • Browser [e.g. stock browser, safari]
  • Version [e.g. 22]

Additional context
Add any other context about the problem here.

method to load new slides

Is your feature request related to a problem? Please describe.
I'm using the marquee as a stock ticker and it would be nice to be able to update data being streamed without re-rendering the marquee completely.

Describe the solution you'd like
It would be nice to have a method that allows you to send a new set of data that replaces the current data once the current loop is finished. To explain a little clearer, what I'm proposing is that once the data is received by the method it waits until the last piece of current content and then begins feeding the new content from that point on. So you would have [old3] [old4] [new1] [new2]. That would make the transition seamless.

Potential issue with running the library in Quasar under SSR mode

Posted on behalf of another user. Putting it in here for tracking purposes

[Vue Router warn]: uncaught error during route navigation:
Error [ERR_REQUIRE_ESM]: require() of ES Module /<PATH_TO_PROJECT>/node_modules/vue3-marquee/dist/vue3-marquee.cjs.js from /<PATH_TO_PROJECT> not supported.
vue3-marquee.cjs.js is treated as an ES module file as it is a .js file whose nearest parent package.json contains "type": "module" which declares all .js files in that package scope as ES modules.
Instead rename vue3-marquee.cjs.js to end in .cjs, change the requiring code to use dynamic import() which is available in all CommonJS modules, or change "type": "module" to "type": "commonjs" in /<PATH_TO_PROJECT>/node_modules/vue3-marquee/package.json to treat all .js files as CommonJS (using .mjs for all ES modules instead).

    at _require (/<PATH_TO_PROJECT>[/node_modules/@quasar/ssr-helpers/lib/create-bundle.js:56:9](mailto:/node_modules/@quasar/ssr-helpers/lib/create-bundle.js:56:9))
    at vue3-marquee (render-app.js:578:18)
    at __webpack_require__ (render-app.js:602:41)
    at ./node_modules/babel-loader/lib/index.js??clonedRuleSet-1.use[0][!./node_modules/@quasar/app-webpack/lib/webpack/loader.vue.auto-import-quasar.js??ruleSet[0].use[0]!./node_modules/vue-loader/dist/index.js??ruleSet[0].use[1]!./src/components/InDemandPackComponent.vue?vue&type=script&setup=true&lang=js](mailto:!./node_modules/@quasar/app-webpack/lib/webpack/loader.vue.auto-import-quasar.js??ruleSet%5b0%5d.use%5b0%5d!./node_modules/vue-loader/dist/index.js??ruleSet%5b0%5d.use%5b1%5d!./src/components/InDemandPackComponent.vue?vue&type=script&setup=true&lang=js) (chunk-src_pages_CompletePage_vue.js:176:70)
    at __webpack_require__ (render-app.js:602:41)
    at ./src/components/InDemandPackComponent.vue?vue&type=script&setup=true&lang=js (chunk-src_pages_CompletePage_vue.js:671:327)
    at __webpack_require__ (render-app.js:602:41)
    at ./src/components/InDemandPackComponent.vue (chunk-src_pages_CompletePage_vue.js:46:119)
    at __webpack_require__ (render-app.js:602:41)
    at ./node_modules/babel-loader/lib/index.js??clonedRuleSet-1.use[0][!./node_modules/@quasar/app-webpack/lib/webpack/loader.vue.auto-import-quasar.js??ruleSet[0].use[0]!./node_modules/vue-loader/dist/index.js??ruleSet[0].use[1]!./src/pages/CompletePage.vue?vue&type=script&setup=true&lang=js](mailto:!./node_modules/@quasar/app-webpack/lib/webpack/loader.vue.auto-import-quasar.js??ruleSet%5b0%5d.use%5b0%5d!./node_modules/vue-loader/dist/index.js??ruleSet%5b0%5d.use%5b1%5d!./src/pages/CompletePage.vue?vue&type=script&setup=true&lang=js) (chunk-src_pages_CompletePage_vue.js:296:98)
    at __webpack_require__ (render-app.js:602:41)
    at ./src/pages/CompletePage.vue?vue&type=script&setup=true&lang=js (chunk-src_pages_CompletePage_vue.js:701:318)
    at __webpack_require__ (render-app.js:602:41)
    at ./src/pages/CompletePage.vue (chunk-src_pages_CompletePage_vue.js:104:110)
    at Function.__webpack_require__ (render-app.js:602:41) {
  code: 'ERR_REQUIRE_ESM'
}

[Quasar Dev Webserver] / -> error during render
Error [ERR_REQUIRE_ESM]: require() of ES Module /<PATH_TO_PROJECT>/node_modules/vue3-marquee/dist/vue3-marquee.cjs.js from /<PATH_TO_PROJECT> not supported.
vue3-marquee.cjs.js is treated as an ES module file as it is a .js file whose nearest parent package.json contains "type": "module" which declares all .js files in that package scope as ES modules.
Instead rename vue3-marquee.cjs.js to end in .cjs, change the requiring code to use dynamic import() which is available in all CommonJS modules, or change "type": "module" to "type": "commonjs" in /<PATH_TO_PROJECT>/node_modules/vue3-marquee/package.json to treat all .js files as CommonJS (using .mjs for all ES modules instead).

    at _require (/<PATH_TO_PROJECT>[/node_modules/@quasar/ssr-helpers/lib/create-bundle.js:56:9](mailto:/node_modules/@quasar/ssr-helpers/lib/create-bundle.js:56:9))
    at vue3-marquee (render-app.js:578:18)
    at __webpack_require__ (render-app.js:602:41)
    at ./node_modules/babel-loader/lib/index.js??clonedRuleSet-1.use[0][!./node_modules/@quasar/app-webpack/lib/webpack/loader.vue.auto-import-quasar.js??ruleSet[0].use[0]!./node_modules/vue-loader/dist/index.js??ruleSet[0].use[1]!./src/components/InDemandPackComponent.vue?vue&type=script&setup=true&lang=js](mailto:!./node_modules/@quasar/app-webpack/lib/webpack/loader.vue.auto-import-quasar.js??ruleSet%5b0%5d.use%5b0%5d!./node_modules/vue-loader/dist/index.js??ruleSet%5b0%5d.use%5b1%5d!./src/components/InDemandPackComponent.vue?vue&type=script&setup=true&lang=js) (chunk-src_pages_CompletePage_vue.js:176:70)
    at __webpack_require__ (render-app.js:602:41)
    at ./src/components/InDemandPackComponent.vue?vue&type=script&setup=true&lang=js (chunk-src_pages_CompletePage_vue.js:671:327)
    at __webpack_require__ (render-app.js:602:41)
    at ./src/components/InDemandPackComponent.vue (chunk-src_pages_CompletePage_vue.js:46:119)
    at __webpack_require__ (render-app.js:602:41)
    at ./node_modules/babel-loader/lib/index.js??clonedRuleSet-1.use[0][!./node_modules/@quasar/app-webpack/lib/webpack/loader.vue.auto-import-quasar.js??ruleSet[0].use[0]!./node_modules/vue-loader/dist/index.js??ruleSet[0].use[1]!./src/pages/CompletePage.vue?vue&type=script&setup=true&lang=js](mailto:!./node_modules/@quasar/app-webpack/lib/webpack/loader.vue.auto-import-quasar.js??ruleSet%5b0%5d.use%5b0%5d!./node_modules/vue-loader/dist/index.js??ruleSet%5b0%5d.use%5b1%5d!./src/pages/CompletePage.vue?vue&type=script&setup=true&lang=js) (chunk-src_pages_CompletePage_vue.js:296:98)
    at __webpack_require__ (render-app.js:602:41)
    at ./src/pages/CompletePage.vue?vue&type=script&setup=true&lang=js (chunk-src_pages_CompletePage_vue.js:701:318)
    at __webpack_require__ (render-app.js:602:41)
    at ./src/pages/CompletePage.vue (chunk-src_pages_CompletePage_vue.js:104:110)
    at Function.__webpack_require__ (render-app.js:602:41)
node:internal/errors:496
    ErrorCaptureStackTrace(err);
    ^

TypeError: The "path" argument must be of type string. Received null
    at new NodeError (node:internal/errors:405:5)
    at validateString (node:internal/validators:162:11)
    at join (node:path:1175:7)
    at getFilename ([file:///<PATH_TO_PROJECT>/node_modules/@quasar/render-ssr-error/src/stack.js:12:26](file:///%3cPATH_TO_PROJECT%3e/node_modules/@quasar/render-ssr-error/src/stack.js:12:26))
    at getSource ([file:///<PATH_TO_PROJECT>/node_modules/@quasar/render-ssr-error/src/stack.js:21:20](file:///%3cPATH_TO_PROJECT%3e/node_modules/@quasar/render-ssr-error/src/stack.js:21:20))
    at [file:///<PATH_TO_PROJECT>/node_modules/@quasar/render-ssr-error/src/stack.js:63:38](file:///%3cPATH_TO_PROJECT%3e/node_modules/@quasar/render-ssr-error/src/stack.js:63:38)
    at Array.map (<anonymous>)
    at getStack ([file:///<PATH_TO_PROJECT>/node_modules/@quasar/render-ssr-error/src/stack.js:62:16](file:///%3cPATH_TO_PROJECT%3e/node_modules/@quasar/render-ssr-error/src/stack.js:62:16))
    at renderSSRError ([file:///<PATH_TO_PROJECT>/node_modules/@quasar/render-ssr-error/src/index.js:21:12](file:///%3cPATH_TO_PROJECT%3e/node_modules/@quasar/render-ssr-error/src/index.js:21:12))
    at Object.renderError [as error] (/<PATH_TO_PROJECT>[/node_modules/@quasar/app-webpack/lib/dev-server-ssr.js:28:3](mailto:/node_modules/@quasar/app-webpack/lib/dev-server-ssr.js:28:3))
    at eval (webpack://<PATH_TO_PROJECT>/./src-ssr/middlewares/render.js?:46:17) {
  code: 'ERR_INVALID_ARG_TYPE'
}

Node.js v20.3.1
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

nuxt3 error using Vue3Marquee.client.ts -> Vue3Marquee.ts ok

I did setup the project as described in the guide for nuxt3: https://vue3-marquee.vercel.app/guide.html#nuxt-3

But this gives error on the server side.

[Vue warn]: Failed to resolve component: Vue3Marquee                                                                                                  15:47:20
If this is a native custom element, make sure to exclude it from component resolution via compilerOptions.isCustomElement.
[Vue warn]: Non-function value encountered for default slot. Prefer function slots for better performance.                                            15:47:20
[Vue warn]: Component <Anonymous> is missing template or render function.                                                                             15:47:20
[Vue warn]: Non-function value encountered for default slot. Prefer function slots for better performance.                                            15:47:20
[Vue warn]: Component <Anonymous> is missing template or render function.                                                                             15:47:20
[Vue warn]: Non-function value encountered for default slot. Prefer function slots for better performance.

Changing Vue3Marquee.client.ts to Vue3Marquee.ts removes the errors.

features i want to have

it is possible to set the amount of times for looping items?
how do I know when it is finished the animation?

鼠标经过时,跑马灯会暂停,但是当我鼠标按下时,跑马灯又会自己跑动了

Describe the bug
A clear and concise description of what the bug is.

To Reproduce
Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: [e.g. iOS]
  • Browser [e.g. chrome, safari]
  • Version [e.g. 22]

Smartphone (please complete the following information):

  • Device: [e.g. iPhone6]
  • OS: [e.g. iOS8.1]
  • Browser [e.g. stock browser, safari]
  • Version [e.g. 22]

Additional context
Add any other context about the problem here.

how to scroll vertically

Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

Describe the solution you'd like
A clear and concise description of what you want to happen.

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Additional context
Add any other context or screenshots about the feature request here.

Does it support vertical scrolling

Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

Describe the solution you'd like
A clear and concise description of what you want to happen.

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Additional context
Add any other context or screenshots about the feature request here.

make vue 3 marquee move vertically

i know this is possible and i've been trying to do it on my end, but i'm not getting it. if possible can someone implement it and i just check the code and learn from it. thanks

Typescript support

First of all, thank you for building this library.

Would be nice to have a typescript support even having a good documentation.

Speed issue with multiple component on same page

when use the multiple marquee component on the same page then duration speed is not working same for all component.
For the first component speed is proper but for all other duration is not working.

Example of code
<Vue3Marquee :clone="true"> <img :src="img" v-for="img in imgArray" :key="img" class="image" width="100" /> </Vue3Marquee>

Please let me know i'm missing anything.

Thanks

While the marquee is paused via hover, the onLoopComplete continues

Hello - first of all, thank you for the time you've put so far into this project.
I've been playing around with the component to fit my needs (more of a live feed with data), and the component is flexible enough for me to achieve my goal.

One thing that I noticed while working on my piece, is that if you register onLoopComplete event handler while at the same time enabling the pauseOnHover, if the user hovers on the marquee (pausing the motion as expected), the internal clock proceeds, and triggers onLoopComplete while in fact marquee has been idle for a long period of time now, leading to logic getting out of sync in the long run.

Steps to reproduce:

  • Create a relatively short duration for a marquee, i.e. 5s (can be any, but it's easier to see in that case)
  • Register a console.log to onLoopComplete
  • Enable :pause-on-hover="true"
  • Hover on the component
  • Wait for some time, i.e. 20s
  • See that the handler has been invoked regardless of animation being paused

I would expect the internal clock to pause when hovering - or, maybe the internal clock can be removed completely if we add an intersection observer to some static, built in hidden element that would be at the end of the loop - and trigger when the element gets out of sight.

Again, thanks for all your hard work with this!

`onComplete` & `onLoopComplete` not working

Description:
I am using the vue3-marquee library and have set up a component with the onComplete prop. However, it is not working as expected and instead of triggering when the animation completes, it is triggered when the page loads. Here is the code I am using:

<template>
    <Vue3Marquee :pauseOnClick="true" :duration="1" :onComplete="a()">
        <div>123</div>
    </Vue3Marquee>
</template>

<script setup lang="ts">
import { Vue3Marquee } from 'vue3-marquee'
import 'vue3-marquee/dist/style.css'

let a = () => {
    console.log('complete')
}
</script>

Steps to reproduce:

  1. Set up a component using vue3-marquee library
  2. Use the onComplete prop to trigger a function when animation completes
  3. Load the page and observe that the onComplete function is triggered immediately

Expected behavior:
The onComplete function should only be triggered when the animation completes, not when the page loads.

Actual behavior:
The onComplete function is triggered immediately when the page loads, instead of when the animation completes.

Please help me resolve this issue. Thank you.

Warning Component is missing template or render function

Warning Component is missing template or render function

version
3.1.2

console
[Vue warn]: Component is missing template or render function.
at
at


at <Index onVnodeUnmounted=fn ref=Ref< undefined > >
at
at

  <Vue3Marquee :duration="Global.FooterMarqueeDuration">
        <span class="notice-text">
          <span v-for="item in state.list" class="mr10">{{ item.content }}</span>
        </span>
</Vue3Marquee>

The first items are not visible

I have 57 items. but the first items about 20 items not visible. my page when loaded It starts to be displayed from item 21.

`

.slider.slider__doctors
ul(style="flex")
//Vue3Marquee(:duration="100")
li(v-for="doctor in doctors")
span.slider__doctors__name {{ doctor.full_name }}
span.slider__doctors__expert ({{ doctor.expert_type }} {{ doctor.expert }})

  //Vue3Marquee(direction="reverse")
  //  li(v-for="(doctor, index) in doctors" :key="index")
  //      span.slider__doctors__name {{ doctor.full_name }}
  //      span.slider__doctors__expert  ({{ doctor.expert }})
<script lang="ts"> import { defineComponent, ref, toRefs, watch } from "vue"; import { Vue3Marquee } from "vue3-marquee"; import "vue3-marquee/dist/style.css"; import { fileBaseUrl } from "@/services/appConfig"; export default defineComponent({ components: { Vue3Marquee, }, props: { doctors: { type: Array, default: () => [], }, }, setup(props, { emit }) { return { fileBaseUrl, }; }, }); </script> <style></style>

`

my style:

#main .slider__doctors { padding: 30px; background-color: #08B89D; position: fixed; bottom: 0px; right: 0px; left: 0px; z-index: 200; display: -webkit-box; display: -webkit-flex; display: -ms-flexbox; display: flex; overflow: hidden; width: 100%; -webkit-box-pack: start; -webkit-justify-content: flex-start; -ms-flex-pack: start; justify-content: flex-start; -webkit-box-align: center; -webkit-align-items: center; -ms-flex-align: center; align-items: center; } #main .slider__doctors ul { position: absolute; top: 8px; left: 0px; white-space: nowrap; will-change: transform; animation: marquee-horizontal-alt 120s linear infinite; display: -webkit-box; display: -webkit-flex; display: -ms-flexbox; list-style: none; display: flex; -webkit-box-pack: start; -webkit-justify-content: flex-start; -ms-flex-pack: start; justify-content: flex-start; -webkit-box-align: center; -webkit-align-items: center; -ms-flex-align: center; align-items: center; } #main .slider__doctors ul li { margin-right: 2vw; -webkit-box-flex: 0; -webkit-flex: 0 0 auto; -ms-flex: 0 0 auto; flex: 0 0 auto; color: #fff; text-transform: uppercase; }

Images don't display without human input

Describe the bug
When having images on the marque they don't display after some time until there is input form a human. The images also do not show the alt tag. It happens both on mobile phones and on desktops.

To Reproduce

<template>
 <vue3-marquee :duration="images.length * 2" direction="reverse" >
          <div v-for="image in images" style="height: 10rem; width: 10rem">
            <img
              :src="image.url"
              :alt="image.alt"
              width="10rem"
              height="10rem"
            />
          </div>
        </vue3-marquee>
</template>

<script>
export default {
  name: "ImageMarquee",
data() { return {
   images: [
{ url: "https://i.scdn.co/image/ab67616d0000b273582e9468816fb5c756af2e57", alt: "See the Light" },
{ url: "https://i.scdn.co/image/ab67616d0000b273d10aa62551fcacbfcbf080e6", alt: "I Feel Love" },
{ url: "https://i.scdn.co/image/ab67616d0000b27360d6fa857326b42347a02f2f", alt: "Honolulu" },
{ url: "https://i.scdn.co/image/ab67616d0000b273355bf68fa788b6d401195b43", alt: "Birthday" },
{ url: "https://i.scdn.co/image/ab67616d0000b273790ed852cb7ff16f747f1cb0", alt: "Put Your Records On - Extended" },
{ url: "https://i.scdn.co/image/ab67616d0000b27359518e073a73c42b539c016e", alt: "Drug" },
{ url: "https://i.scdn.co/image/ab67616d0000b2733a298c3616105dc74f25f44e", alt: "Spliff Break" },
{ url: "https://i.scdn.co/image/ab67616d0000b273758a3b6adc50476dbf3d854c", alt: "Satellites" },
{ url: "https://i.scdn.co/image/ab67616d0000b273aaf9b6f079044a34219c3f6d", alt: "Insight" },
{ url: "https://i.scdn.co/image/ab67616d0000b273808911b13ac4a9f2767b0327", alt: "You See" },
{ url: "https://i.scdn.co/image/ab67616d0000b273ca430ba8cd161c0b99c555c7", alt: "Virtual Connectives" },
{ url: "https://i.scdn.co/image/ab67616d0000b273fe9c5fb6e783d2e912b8b0e6", alt: "Microwave Love (feat. Black Rose)" },
{ url: "https://i.scdn.co/image/ab67616d0000b2736a914f59a9ed1f82e64f52e0", alt: "Tonic Water" },
{ url: "https://i.scdn.co/image/ab67616d0000b273ec4adddeec6b615c14cc16ca", alt: "What You Need" },
{ url: "https://i.scdn.co/image/ab67616d0000b273f1814f1b76df2fa196e4f45e", alt: "Queen Tings" },
{ url: "https://i.scdn.co/image/ab67616d0000b2737bc631e0077b1b10012c53f2", alt: "High With Me" },
{ url: "https://i.scdn.co/image/ab67616d0000b2730b1804895a3ce499c4212bca", alt: "If You Want Me to Stay" },
{ url: "https://i.scdn.co/image/ab67616d0000b273660ee24281a547103f466ff5", alt: "SOS (feat. Aloe Blacc)" },
{ url: "https://i.scdn.co/image/ab67616d0000b273a59b7f91e32078ab2015ac1e", alt: "Up All Night - Marlin Remix" },
{ url: "https://i.scdn.co/image/ab67616d0000b2734ba905686e42400b51a64964", alt: "Promises - Delusion Remix" },
{ url: "https://i.scdn.co/image/ab67616d0000b273eeaf53d6704e7f2cc10cdfe1", alt: "Yep (DJ Greem Remix)" },
{ url: "https://i.scdn.co/image/ab67616d0000b27306e542a76d9d025ecd441fc0", alt: "I Know" },
{ url: "https://i.scdn.co/image/ab67616d0000b273afe4f3225228970213f04ed4", alt: "Butterfly - HotSix Remix" },
{ url: "https://i.scdn.co/image/ab67616d0000b27333cb38e569c02a7e256d0567", alt: "Bucket" },
{ url: "https://i.scdn.co/image/ab67616d0000b273d390959718fdaab2d460f705", alt: "The Rubberband Man" },
]
}
}
}
</script>

Expected behavior
I expected the images to stay visible.

Screenshots
image

Desktop (please complete the following information):

  • OS: Windows
  • Browser: Vivaldi
  • Version: 5.2.2623.41 (Stable channel) (64-bit)

Additional context
It is not like the browser could not fetch the image it just decides not to for some reason. There is no alt tag which would indicate that the browser did not fetch the image. Do you think this is an issue with your component?

clone=true with a short text clones infinitely when wrapped in a flex container

Describe the bug
When using clone=true and wrapping a marquee with a short text (e.g. 123) in a container with display: flex, the contents of the marquee are cloned near infinitely.

To Reproduce
Steps to reproduce the behavior:

  1. Create a vue3-marquee with :clone="true" and 123 in its default slot
  2. Wrap it in a div with style="display: flex;"
  3. The marquee now keeps cloning the content inside of it for ever

Can be reproduced in the Sandbox.

Expected behavior
The marquee should behave as normal.

Screenshots
Bildschirmfoto 2022-03-01 um 11 32 13

(note the long scrollbar in the screenshot, it keeps getting longer)

Desktop (please complete the following information):

  • OS: macOS 12.2.1 (21D62)
  • Browser Google Chrome
  • Version 98.0.4758.109 (Official Build) (x86_64)

Smartphone (please complete the following information):

  • Device: n/a
  • OS: n/a
  • Browser n/a
  • Version n/a

Additional context
n/a

does marquee support 'no-scroll' when the marquee content only have one item?

Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

Describe the solution you'd like
A clear and concise description of what you want to happen.

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Additional context
Add any other context or screenshots about the feature request here.

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Rate-Limited

These updates are currently rate-limited. Click on a checkbox below to force their creation now.

  • chore(deps): update dependency @nuxt/devtools to v1.3.3
  • chore(deps): update dependency vue-router to v4.3.3
  • chore(deps): update dependency @types/node to v20.14.2
  • chore(deps): update dependency prettier to v3.3.2
  • chore(deps): update dependency eslint to v9
  • chore(deps): update dependency string-width to v7
  • chore(deps): update dependency vue-tsc to v2
  • chore(deps): update github/codeql-action action to v3
  • 🔐 Create all rate-limited PRs at once 🔐

Edited/Blocked

These updates have been manually edited so Renovate will no longer make changes. To discard all commits and start over, click on a checkbox.

  • fix(deps): update dependency prettier to v3

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Detected dependencies

github-actions
.github/workflows/check-misspellings.yml
  • actions/checkout v4
.github/workflows/codeql-analysis.yml
  • actions/checkout v4
  • github/codeql-action v2
  • github/codeql-action v2
  • github/codeql-action v2
.github/workflows/lint-check.yml
  • actions/checkout v4
  • actions/setup-node v4
  • wearerequired/lint-action v2
.github/workflows/stale.yml
  • actions/stale v9
npm
docs/package.json
  • vue3-lottie ^3.0.0
  • vue3-marquee ^4.2.0
  • @nuxt-themes/docus ^1.12.1
  • @nuxt/devtools ^1.0.0
  • @nuxt/eslint-config ^0.3.0
  • @nuxtjs/plausible ^0.2.1
  • @types/node ^20.2.5
  • eslint ^8.42.0
  • nuxt 3.10.0
  • string-width 4.2.3
package.json
  • prettier 2.8.8
packages/playground/nuxt-project/package.json
  • nuxt ^3.9.3
  • vue ^3.4.14
  • vue-router ^4.2.5
packages/playground/vite-project/package.json
  • vue 3.3.10
  • @vitejs/plugin-vue 2.3.4
  • typescript 5.4.5
  • vite 2.9.18
  • vue-tsc 0.40.13
packages/vue3-marquee/package.json
  • @babel/types 7.24.0
  • @types/node 20.8.10
  • @vitejs/plugin-vue 2.3.4
  • @vue/compiler-sfc ^3.3.4
  • typescript 5.4.5
  • vite 2.9.18
  • vite-plugin-css-injected-by-js ^3.1.2
  • vite-plugin-dts ^3.0.0-beta.3
  • vite-plugin-vue-type-imports ^0.2.4
  • vue 3.3.8
  • vue-tsc 0.40.13
  • vue-typegen 0.2.0
  • vue ^3.2
wind/package.json
  • vue3-lottie ^3.2.0
  • vue3-marquee ^4.2.0-beta.1
  • prettier ^3.2.5

  • Check this box to trigger a request for Renovate to run again on this repository

how to set the fix running speed of marquee

the speed is normal if small amount of item in marquee, however, it run faster if more items in the marquee, , is it possible to set the fix running speed of the item?
I also tried to set the duration in code, it still moved faster if there are large amount of item in the marquee

Looping doesn't work, just freezes page

Describe the bug
Looping doesn't work, it just freezes page.

[Violation] Forced reflow while executing JavaScript took <N>ms

In console

To Reproduce
Steps to reproduce the behavior:

  1. Create a marquee with this code:
<template>
  <div class="absolute z-50 right-32 bottom-32 flex flex-row space-x-8 max-h-screen overflow-hidden">
    <Vue3Marquee :clone="true">
      <div class="w-16 h-16 mr-8 flex items-center justify-center rounded-full bg-[#1e1e1e]">
        hello
      </div>

      <div class="w-16 h-16 mr-8 flex items-center justify-center rounded-full bg-[#1e1e1e]">
        bye
      </div>
    </Vue3Marquee>
  </div>
</template>
  1. Set loop to true
  2. Run project

Expected behavior
Should loop elements and scroll through them

Screenshots
If applicable, add screenshots to help explain your problem.

Screen.Recording.2023-10-27.at.21.33.31.mov
  • OS: macOS
  • Browser: Brave
  • Version: 1.59.117

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.