Callback typed.js-在每个新字符串之前使用preStringTyped调用自定义函数

Callback typed.js-在每个新字符串之前使用preStringTyped调用自定义函数,callback,typed.js,Callback,Typed.js,在键入每个新字符串之前尝试启动自定义函数。希望字符串循环,使用智能退格,并且对SEO友好。这可能吗 jsfiddle: HTML <h1 id="typed-strings" class="page-title"> <span>Built to be Autonomous.</span> <span>Built to be Reliable.</span> <span>Built to be Portable.&

在键入每个新字符串之前尝试启动自定义函数。希望字符串循环,使用智能退格,并且对SEO友好。这可能吗

jsfiddle:

HTML

<h1 id="typed-strings" class="page-title">
  <span>Built to be Autonomous.</span>
  <span>Built to be Reliable.</span>
  <span>Built to be Portable.</span>
  <span>Built to Last.</span>
</h1>
<h2 class="h1 page-title">
  <span id="typed"></span>
</h2>
上面的代码应该在开始键入每个新字符串之前发出警报。它使用智能退格循环,但是在输入每个新字符串之前,它不会发出警报。有什么想法吗

var typed = new Typed("#typed", {
  stringsElement: '#typed-strings',
  typeSpeed: 50,
  backSpeed: 10,
  backDelay: 2000,
  smartBackspace: true,
  loop: true,
  loopCount: false,
  preStringTyped: function(index, self) {
    alert(index);
   // Fire custom function here
 },
});