Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.9k views
in Technique[技术] by (71.8m points)

React+antd 实现文本滚动

image.png
有一个很长的文本,想要实现上下自动滚动,就是进入页面,不需要任何操作,文本自动从开头滚动


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

之前有个 marquee 标签不过废弃了,这个要自己封装吧,可以搜一下别人的实现。基本思路应该就是:利用定时器,固定时间内修改偏移量;长文本可以考虑虚拟滚动,或者裁剪数组。


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...