Textillate w/ jQuery不起作用.未捕获的类型错误: $ 未定义
Textillate w/ jQuery not functioning. Uncaught TypeError: $ is not defined
好吧,我觉得我已经尝试了一切。我知道有很多类似的问题,但我对Javascript不是很熟悉,所以我读过的其他答案远远超出了我的头脑。我得到:
尝试运行 Textillate 脚本时Uncaught ReferenceError: $ is not defined
:
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<?php include('head.php'); ?>
<!-- Bootstrap -->
<link href="css/bootstrap.min.css" type="text/css" rel="stylesheet">
<link href="css/custom.css?version=1.4" type="text/css" rel="stylesheet">
<link href="css/animate.css" type="text/css" rel="stylesheet">
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<!-- Include all compiled plugins (below), or include individual files as needed -->
<script type="text/javascript" src="http://code.jquery.com/jquery-1.11.0.min.js" async></script>
<script type="text/javascript" src="js/bootstrap.min.js" async></script>
<script type="text/javascript" src="js/jquery.lettering.js" async></script>
<script type="text/javascript" src="js/jquery.textillate.js" async></script>
<script>
$(function() {
$('.txt').textillate({
in: { effect: 'rollIn' },
out: { effect: 'foldUnfold', sync: true },
loop: true
});
</script>
我已经按照文档的指示在<head>
中加载了最新版本的jQuery,animate.css,textillate.js和lettering.js。
我的HTML是这样的:
<h1 class="txt" data-in-effect="rollIn">text</h1>
有人可以用最简单的术语告诉问题所在以及如何解决此错误吗?
我错过的东西可能是显而易见的,但就像我说的,我是一个菜鸟。现场演示可以在这里找到:www.thekdesignco.com/new/
第一个问题是:sript-tags中的async
-属性。使用async
HTML解析器不会等到脚本加载完毕。所以 DOM 首先准备好了,$(function() {})
在 jQuery 出现之前被执行。
第二个问题:上一个脚本中的函数未正确关闭。它必须看起来像:
$(function() {
$('.txt').textillate({
in: { effect: 'rollIn' },
out: { effect: 'foldUnfold', sync: true },
loop: true
});
});
请立即修复它。
第三个问题:某个地方<
太多或错误的地方。这似乎是jquery.textillate.js
文件中的问题。当我找到它时,我会更新这个答案。
编辑:js/jquery.textillate.js
中的文件不是jquery.textillate.js而是一些未知的HTML文件。清理你的js-folder
.
using jquery.noconflict();
将解决问题。
相关文章:
- 为什么会出现错误;未捕获的类型错误:undefined不是函数;
- 同样,同样的错误'ahorcado.js:26未捕获类型错误:无法读取属性'beginPath'
- 未捕获的类型错误:无法读取属性'删除'的未定义
- 未捕获的类型错误:无法读取属性'name'即使它存在,也无法定义
- 看到“;未捕获的类型错误:无法读取属性'weight'未定义的“;尽管按照字面上的指示
- Soundcloud api"未捕获的类型错误:无法读取属性'uri'“未定义”;
- 未捕获的类型错误:无法读取属性'addEventListener'的null chrome扩展名
- 如何解决这种情况下的非法调用类型错误
- 未捕获的类型错误:$(..).dataTable不是函数
- 未捕获的类型错误:无法读取属性'状态'在react中为null
- 未捕获的类型错误:topFrame.window.changeSelectedBarStyle不是函数,原因是什么
- 类型错误:url未定义extjs 4正在填充组合框
- 未捕获的类型错误:无法读取属性'中止'的未定义
- 类型错误'未定义'不是对象(正在评估'navigator.connection.type'
- 未捕获的类型错误:无法设置属性'innerHTML'如果为null,则将脚本移动到正文不会;不起作用
- 未捕获的类型错误:undefined不是函数$
- 输入类型文件的未捕获类型错误
- 未捕获的类型错误:无法设置属性'背景'的未定义
- "未捕获类型错误/丢弃意外“;因为一句台词而出现?(HTML w/<脚本>)
- Javascript未捕获类型错误:无法读取属性'0'的未定义