我使用typewriter.js和contenteditable=“真”。然而,我的问题是,当我键入输入时,我的文本将与typerwriter占位符一起展开。当我在可内容编辑中输入文本时,如何禁用打字机?这是我的密码
<div id="quote__text" contenteditable="true">
var app = document.getElementById('quote__text');
var typewriter = new Typewriter(app, {
loop: true
});
typewriter.typeString('TYPE HERE TO SET GOAL')
.pauseFor(2500)
.deleteAll()
.typeString('GOAL 1')
.pauseFor(2500)
.deleteChars(7)
.typeString('GOAL 2')
.pauseFor(2500)
.start();发布于 2021-12-17 07:37:41
尝试在用户输入文本时停止库
const editor = document.getElementById("quote__text");
editor.addEventListener("input", stop);
function stop(e) {
typewriter.stop()
}https://stackoverflow.com/questions/70299206
复制相似问题