【发布时间】:2015-10-09 19:06:29
【问题描述】:
我知道这个问题已经在以前的帖子中发布过,但没有任何帮助,这让我发疯了,我更确定答案很简单,但我对 javascript 真的很陌生
我正在尝试从那里整合这个 raptor-konami 代码:http://zurb.com/playground/jquery-raptorize
所以我 c/p 我的 html 文件文件夹中的所有内容,我在我的 head 中获得了 src 文件夹,但我在控制台中不断收到此错误:
Uncaught TypeError: $(...).raptorize is not a function
我真的不知道为什么。这是我的头部内容,与插件文件夹中提供的示例 html 文件中的内容完全相同(标题页除外),并且有效!!!
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<title>Personnal Website</title>
<!-- jQuery: Grab Google CDN jQuery. fall back to local if necessary -->
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script>!window.jQuery && document.write('<script src="jquery-1.4.1.min.js"><\/script>')</script>
<!-- The raptorize file -->
<script src="jquery.raptorize.1.0.js"></script>
<!-- For the button version -->
<!-- For the Konami Code version -->
<script type="text/javascript">
$(window).load(function() {
$('.button').raptorize({
'enterOn' : 'konami-code'
});
});
</script>
<!-- For the Timer version -->
<!-- <script type="text/javascript">
$(window).load(function() {
$('.button').raptorize({
'enterOn' : 'timer',
'delayTime' : 2000
});
});
</script>
-->
<link rel="stylesheet" href="css/demo-styles.css" />
</head>
jquery.raptorize.1.0.js的源码可以看这里:
http://zurb.com/playground/uploads/upload/upload/254/jquery.raptorize.js
我已经尝试了很多东西,比如将 de $ 更改为 jQuery,将 (document).load 更改为 (document).ready,但没有任何效果我仍然在控制台中收到此错误,我不知道为什么。 . 有人可以帮帮我吗?
非常感谢。
【问题讨论】:
-
@244an — 为什么?万一将方法绑定到 jQuery 对象的时间出现问题,尝试尽快访问它不会有帮助。
-
@244an — 我的观点是正确的。
-
@damouf 检查浏览器的网络选项卡并确保正确加载了 raptorize 脚本。
-
@damouf - 您网站上的 jquery.raptorize.1.0.js(如果存在)可能与您尝试使用它的页面不在同一个文件夹中。
-
@244an 应尽可能避免尝试和错误编程。努力了解为什么您编写自己编写的代码。
标签: javascript jquery html function