【发布时间】:2018-03-13 05:53:05
【问题描述】:
我正在使用这个库https://github.com/mattboldt/typed.js/。我已经在正文代码的末尾添加了所有脚本文件,但我仍然在控制台中遇到错误。我的代码是:
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>LUNA-NG</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="apple-touch-icon" href="apple-touch-icon.png">
<link href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:200,400,700,900' rel='stylesheet" type="text/css">
<link rel="stylesheet" href="css/bootstrap.min.css">
<link href="https://fonts.googleapis.com/css?family=Montserrat:100,200,300,400,500,600,700,800,900" rel="stylesheet">
<link rel="stylesheet" href="css/bootstrap-theme.min.css">
<link rel="stylesheet" href="css/fontAwesome.css">
<link rel="stylesheet" href="css/tooplate-style.css">
<link rel="stylesheet" href="node_modules/typed.js/assets/demos.css">
</head>
<body>
<span class="typed"></span>
<script src="js/vendor/jquery-1.11.2.min.js"></script>
<script src="js/vendor/bootstrap.min.js"></script>
<script src="js/plugins.js"></script>
<script src="js/main.js"></script>
<script src="node_modules/animejs/anime.min.js"></script>
<!-- Google Analytics: change UA-XXXXX-X to be your site's ID. -->
<script>
(function(b,o,i,l,e,r){b.GoogleAnalyticsObject=l;b[l]||(b[l]=
function(){(b[l].q=b[l].q||[]).push(arguments)});b[l].l=+new Date;
e=o.createElement(i);r=o.getElementsByTagName(i)[0];
e.src='//www.google-analytics.com/analytics.js';
r.parentNode.insertBefore(e,r)}(window,document,'script','ga'));
ga('create','UA-XXXXX-X','auto');ga('send','pageview');
</script>
<script type="text/javascript" src="jquery.interactive_3d.js"></script>
<script src="node_modules/typed.js/lib/typed.js"></script>
<script>
$(function() {
$(".typed").typed({
strings: ["Typed.js is a jQuery plugin that types.", "Enter in any string,", "and watch it type at the speed you've set,", "backspace what it's typed,", "and begin a new sentence for however many strings you've set."],
typeSpeed: 0
});
});
</script>
控制台:
Uncaught TypeError: $(...).typed is not a function
at HTMLDocument.<anonymous> ((index):259)
at j (jquery-1.11.2.min.js:2)
at Object.fireWith [as resolveWith] (jquery-1.11.2.min.js:2)
at Function.ready (jquery-1.11.2.min.js:2)
at HTMLDocument.J (jquery-1.11.2.min.js:2)
非常感谢您在这方面的任何帮助。提前致谢。
【问题讨论】:
-
看起来那个库不是 jQiery 插件。尝试使用
Typed构造函数,就像您链接的仓库中的自述文件显示的那样。 -
@Paulpro codepen.io/merb/pen/yOwJjj 请看这段代码。
-
@waheedshah 它似乎 不再 是一个 jQuery 插件,从 v2 开始在没有 jQuery 的情况下被重写。 v1 的最后一次更新是v1.1.7。
标签: javascript animation dom typed typed.js