I am trying to get typed.js to work and for some reason I just can't get it.
In the header
<script src="/typed.js" type="text/javascript"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js"></script>
And here is the code
<script>
$(function(){
$(".element").typed({
strings: ["First sentence.", "Second sentence."],
typeSpeed: 0
});
});
</script>
<h1><span class="element">test</span></h1>
I took the code right off GitHub. What am I missing?
答案 0 :(得分:1)
TypedJS requires jQuery to be loaded in order to work correctly. Simply swap the order of the scripts in your <head>
section:
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js"></script>
<script src="/typed.js" type="text/javascript"></script>
(assuming your path to typed.js
is accurate)