简体   繁体   English

如何在没有插入符号的情况下使用 HTML、CSS 和 JS 在用户悬停时制作书写动画(文本更改)

[英]How can I make a writing animation(change of text) on a users hover with HTML, CSS, and JS, just without the caret

I'm trying to make something with an effect similar to this (where the text is getting typed on it's own), without the caret, and set that to happen when the user hover's over it.我试图做一些与类似的效果(其中文本是越来越打在它自己的),没有插入符号,并将其设置为当用户将鼠标悬停结束了这一点。 Any help is appreciated, Thanks.任何帮助表示赞赏,谢谢。

This works for one line.这适用于一行。 The only problem is that it doesn't wrap text.唯一的问题是它不换行文本。

 .typewriter { width: fit-content; } .typewriter div { overflow: hidden; white-space: nowrap; margin: 0 auto; letter-spacing: .05em; animation: typing 3.5s steps(40, end), blink-caret .75s step-end infinite; } @keyframes typing { from { width: 0 } to { width: 100% } }
 <div class = 'typewriter'> <div> Lorem ipsum dolor sit amet, consectetur adipiscing elit. </div>

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

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