我正在尝试使用typed.js对h1元素进行输入效果 . 我希望能够在键入新元素之前“退格”h1中的当前字符串 .

$(function(){
  $("#hello").typed({
    strings: ["Hello Connor."],
    typeSpeed: 100
  });
});

$('#categories h3').click(function(){
    var string = this.id;
    $("#categories").fadeOut();
    $('#back').fadeIn();
    $("#hello").typed({
    strings: [string + ".", "word"],
    typeSpeed: 100
});
})

如您所见,每次单击 #categories 中的某个h3元素时,它会在 #hello 元素中键入该字符串 . 我想这样当你单击一个h3时,它会退回#hello元素中的当前字符串,并输出新的字符串