javascript – typed.js文本中的链接

如何在typed.js脚本中放置链接?我需要联系我,链接到联系页面.

    <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>

最佳答案 使用callback参数.

例:

$(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>
点赞