Я пытаюсь использовать библиотеку Typed.js, но она не работает. Это дает мне следующее сообщение об ошибке в консоли:Typed.js - Undefined не является функцией
Uncaught TypeError: undefined is not a function
Ссылка на консоли в эту строку:
$("#typed").typed({
ошибка, кажется, указует я не включил JQuery, но у меня есть.
<!-- TYPED -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="js/typed.js"></script>
<script>
$(function(){
$("#typed").typed({
strings: ["Typed.js is a <strong>jQuery</strong> plugin.", "It <em>types</em> out sentences.", "And then deletes them.", "Try it out!"],
typeSpeed: 30,
backDelay: 500,
loop: false,
contentType: 'html', // or text
// defaults to false for infinite loop
loopCount: false,
callback: function(){ foo(); },
resetCallback: function() { newTyped(); }
});
$(".reset").click(function(){
$("#typed").typed('reset');
});
});
function newTyped(){ /* A new typed object */ }
function foo(){ console.log("Callback"); }
HTML-:
<div class="col-lg-8 col-lg-offset-2 col-md-10 col-md-offset-1">
<div class="post-heading">
<h1>Baresso og Starbucks</h1>
<h2 class="subheading element">Så mange kalorier smider de rundt</h2>
<h2 class="element" id="typed">hej</h2>
<span class="meta">Posted by <a href="https://www.linkedin.com/profile/view?id=176878997&trk=nav_responsive_tab_profile">Kristoffer Andreasen</a> on November 24, 2014</span>
</div>
Это может быть очень простой, но я просто не могу понять это на данный момент. Вы можете мне помочь?
Вы уверены, что путь 'js/typed.js' верен? –
Я решил проблему. JQuery был загружен позже на странице. Дубликат заставил его загрузить после скрипта. Спасибо за помощь. – krillebimbim