我正在使用 Typed.js,一切都按预期工作。但是偶尔打字速度会比预期的慢得多。这对我来说是个问题,因为我在输入文本后使用 timeOut 函数做某事。
有时打字速度完全正常,有时它每秒只输入一个字母,也就是巨大的延迟。我怎样才能解决这个问题?
注意:我在页面上有多个 Typed 对象。这是一个:
var typed = new Typed('#typed-free', {
stringsElement: '#typed-explain-free',
backSpeed: 0,
typeSpeed: 55,
showCursor: false,
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/typed.js/2.0.0/typed.min.js" integrity="sha512-zKaK6G2LZC5YZTX0vKmD7xOwd1zrEEMal4zlTf5Ved/A1RrnW+qt8pWDfo7oz+xeChECS/P9dv6EDwwPwelFfQ==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<div id="typed-free"></div>
<div id='typingExplanation'>
<div id="typed-explain-free">
<p>Welcome this is an example of using Typed where it is lagging too much. </p>
</div>
</div>