Geting Backspace 在 Typed.js 中的字符串前面



正如我在执行我的以下代码中,我在字符串前面修复了一个退格光标。 我尝试了一些方法,但没有用。有没有人知道如何从字符串的前面删除它。请帮助我

$(function() {
$("h2 .first").typed({
strings: ["Hello "],
typeSpeed: 0,
callback: function() {
showThis();
},
});
function showThis() {
$("span.second").typed({
strings: ["First", "Second", "Third"],
backDelay: 1500,
typeSpeed: 100,
backSpeed: 100,
loop: true,
});
}
});
body {
margin: 0;
}
.header {
height: 100vh;
background-color: orange;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}
.typed cursor {
display: none;
}
h2 {
color: white;
font-size: 4.125em;
font-family: Montserrat, sans-serif;
text-align: center;
}
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<script src="https://www.mattboldt.com/demos/typed-js/js/typed.custom.js"></script>
<div class="header">
<h2><span class="first"></span><span class="second"></span></h2>
</div>

尝试在回调中为 .first 类型化函数添加一个函数,用于删除光标。 $('.typed-cursor'(.remove((; 或 document.querySelector('.typed-cursor'(.remove((;

$(function() {
$("h2 .first").typed({
strings: ["Hello "],
typeSpeed: 0,
callback: function() {
showThis();
document.querySelector('.typed-cursor').remove();
},
});
function showThis() {
$("span.second").typed({
strings: ["First", "Second", "Third"],
backDelay: 1500,
typeSpeed: 100,
backSpeed: 100,
loop: true,
});
}
});
body {
margin: 0;
}
.header {
height: 100vh;
background-color: orange;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}
.typed cursor {
display: none;
}
h2 {
color: white;
font-size: 4.125em;
font-family: Montserrat, sans-serif;
text-align: center;
}
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<script src="https://www.mattboldt.com/demos/typed-js/js/typed.custom.js"></script>
<div class="header">
<h2><span class="first"></span><span class="second"></span></h2>
</div>

最新更新