Link in typed.js text

2.2k views Asked by At

How do i put link in typed.js script? I need Contact me, to be linked to contact page.

    <script src="js/typed.js"></script>
    <script>
      $(function(){
          $(".element").typed({
            strings: ["Welcome to my Website.", "Random text... Contact me"],
            typeSpeed: 0
          });
      });
    </script>

 **HTML**

<div class="col-md-12 col-xs-12">
    <h1 class="element"></h1>
 </div>
1

There are 1 answers

4
Nabil Kadimi On BEST ANSWER

Use the callback parameter.

Example:

$(function() {
  $('#awesome').typed({
    strings: ["Welcome to my Website.", "Random text... Contact me"],
    typeSpeed: 0,
    callback: function() {
      $('#awesome').html('<a href="#">' + $('#awesome').html() + '</a>')
    }
  });
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://raw.githubusercontent.com/mattboldt/typed.js/master/js/typed.js"></script>

<div class="col-md-12 col-xs-12">
  <h1 class="element" id="awesome"></h1>
</div>