简体   繁体   中英

How to use `onComplete()` method in typed.js?

I have seen the documentation of typed.js about onComplete() :

All typing is complete

onComplete(self: Typed)

Parameters self (Typed)

it isn't obvious enough. After completion I want to delay 10s before start typing again and I can't use startDelay:10s property for this purpose either because it delays 10s even before start typing.

Here is a sample Code:

  <div class="container">
      <p>This is an <span id="typed"></span> website.</p>
    </div>
    <script src="https://cdn.jsdelivr.net/npm/typed.js@2.0.11"></script>

    <script>
      var typed = new Typed("#typed", {
        strings: ["awesome", "interesting"],
        stringsElement: null,
        typeSpeed: 20,
        startDelay: 1500,
        backSpeed: 20,
 }

thanks

<script>
    var typed = new Typed("#typed", {
        strings: ["awesome", "interesting"],
        stringsElement: null,
        typeSpeed: 20,
        startDelay: 1500,
        backSpeed: 20,

        // callback on complete
        onComplete: function(self) { prettyLog('onCmplete ' + self) }
    });
</script>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM