简体   繁体   English

无限滚动文本,无间隙且内容发生了动态变化

[英]Infinite scrolling text without gap and with dinamically changing content

So I have this issue with something like old deprecated <marquee> . 所以我遇到了像旧的不推荐使用的<marquee>这样的问题。 Here's fiddle: https://jsfiddle.net/qbqz0kay/1/ 这是小提琴: https : //jsfiddle.net/qbqz0kay/1/

It's one (and simpliest) of hundreds of attempts. 这是数百次尝试中的一次(也是最简单的)。 I can't resolve main issues: 我无法解决主要问题:

  1. how to remove the gap between end and (new) beginning of the list (it should be like one infinitely scrolling sentence). 如何消除列表结尾和(新)开头之间的间隔(应该像一个无限滚动的句子)。 I've tried with removing first li elements and adding them to the end but it affected overall dimensions of the list and in consequence - the animation was disrupted. 我尝试删除第一个li元素并将其添加到末尾,但它影响了列表的整体尺寸,结果-动画被破坏了。
  2. part of the list will be changing once in a while (site is connected to websocket) and every change in its content affect dimensions of the list also. 列表的一部分将不时更改(网站已连接到websocket),其内容的每次更改也会影响列表的尺寸。 So again - problem with stuttering animation occured. 再说一遍-发生了口吃动画的问题。

Any ideas how to handle this? 有什么想法如何处理吗? I've seen many ready-made examples but none of them handles those two issues. 我已经看到了许多现成的示例,但是它们都不能处理这两个问题。

Marquee can't help you in this case, as you can't achieve continuous scrolling using this element. 在这种情况下, Marquee无法为您提供帮助,因为您无法使用此元素实现连续滚动。 Instead, just a bit of javascript might do the trick here. 取而代之的是,只有一点点的javascript可能会在这里达到目的。 I tried this example which is also very well documented on my own blog and worked perfectly fine, more on this article: http://www.dynamicdrive.com/dynamicindex2/crawler/index.htm 我尝试了这个示例,该示例在我自己的博客中也有很好的记录,并且工作得很好,有关本文的更多信息: http : //www.dynamicdrive.com/dynamicindex2/crawler/index.htm

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM