如何在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>
答案 0 :(得分:2)
使用回调参数。
$(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>