ezekielaquino / Marquee3000

Marquees for the new millenium
https://ezekielaquino.com/2019/marquee
MIT License
438 stars 81 forks source link

Does marquee3k support dynamic content #5

Open tuanddd opened 6 years ago

tuanddd commented 6 years ago

I am having this case where user can add dynamic <li> content to a div and then the div must adapt to display a continuous marquee with no gap (if 1 <li> then there will be every same <li> on that div and so on)?

ezekielaquino commented 6 years ago

Hello @TuanDSE62171, I think what you're trying to achieve is best served by 1) destroying the marquee 2) re-initialising the marquee

The plugin clones content to fit the parent's width. However, currently only having the refresh method does not serve this purpose: you just don't want dynamic content randomly appended after a series of cloned elements.

Unfortunately, I still haven't had the time to look into cleaning up and introducing a destroy method, as many have already requested before (sorry guys!!!) but it's in the pipeline. If you are using GSAP you might be interested in looking at a WIP version: https://github.com/ezekielaquino/Marquee3G

judson75 commented 5 years ago

I found that if you initiate the script after content is loaded (via ajax), with a 200 millisecond timeout it works.

 setTimeout(function () {
      Marquee3k.init();
 },200);