$(...)。函数不是函数jQuery [英] $(...).function is not a function jQuery

查看:111
本文介绍了$(...)。函数不是函数jQuery的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道这个问题已经发布在以前的文章中,但没有任何帮助我,它让我疯狂,甚至更多我相信答案很简单,但我真的很新的JavaScript



我正在尝试从这里整合此猛禽代码: http: //burb.com/playground/jquery-raptorize



所以我c / p文件夹里的所有内容我的html文件中,我得到了src文件夹在我的中,但我一直在控制台中发现这个错误:

  Uncaught TypeError:$(...)。raptorize不是函数

我真的不知道为什么。这是我的头部内容,它与插件文件夹中提供的示例html文件中的内容完全相同(除了标题页面),并且其工作原理是!!!

 <!DOCTYPE html> 
< html>
< head>
< meta http-equiv =Content-Typecontent =text / html; charset = UTF-8/>
< meta http-equiv =X-UA-Compatiblecontent =IE = edge,chrome = 1/>
< title>个人网站< / title>
<! - jQuery:抓取Google CDN jQuery。必要时回落到当地 - >
< 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>

<! - 猛禽文件 - >
< script src =jquery.raptorize.1.0.js>< / script>

<! - 对于按钮版本 - >


<! - 对于Konami代码版本 - >
< script type =text / javascript>
$(window).load(function(){
$('。button')。raptorize({$ b $'enterOn':'konami-code'
});
});
< / script>

<! - 对于定时器版本 - >
<! - < script type =text / javascript>
$(window).load(function(){
$('。button')。raptorize({$ b $'enterOn':'timer',
'delayTime': 2000
});
});
< / script>
- >

< link rel =stylesheethref =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,但没有任何效果我仍然在控制台中出现此错误,我不明白为什么..有人可以帮助我吗?
$

解决方案

在你的代码中,行号: 135 ,请删除jQuery 1.8.2不必要的重新初始化:

$ p $ <! - = ===================================结束演示包装============ ==================================== - >
< script src =js / jquery-1.8.2.min.js>< / script>

这会删除旧的jQuery并用新的jQuery重写。如果你需要,你可以做这样的事情:

  $ jq = jQuery.noConflict(); 

保留其他所有内容,使 $ 为你工作。是的,正如我在之前的评论中所说的那样,请使用 $(document).ready()事件:

  $(document).ready(function(){
$('。button')。raptorize({$ b $'enterOn':'konami-code '
});
});


I know this issue has been posted in previous posts but nothing helped me and it's driving me crazy, even more I'm sure the answer is pretty simple, but I'm really new to javascript

I'm trying to integrate this raptor-konami-code from there: http://zurb.com/playground/jquery-raptorize

so I c/p all the content in the folder of my html file, I got the src folders right in my head, but I keep getting this error in the console:

Uncaught TypeError: $(...).raptorize is not a function

And I really don't know why. Here is my head content, which is the strictly same (except the title page) of the one in the sample html file provided in the plugin folder and which works!!!

<!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>

the source code of jquery.raptorize.1.0.js can be viewed here:

http://zurb.com/playground/uploads/upload/upload/254/jquery.raptorize.js

I've tried a lot of things, like changing de $ for jQuery, change (document).load to (document).ready, but nothing works I still get this error in the console and I don't why.. Can someone help me please?

Thanks a lot.

解决方案

In your code, line number: 135, please remove the unnecessary re-initialization of jQuery 1.8.2:

<!--====================================end demo wrapper================================================-->
<script src="js/jquery-1.8.2.min.js"></script>

This removes the old jQuery and rewrites it with the new one. If you need, you can do something like this:

$jq = jQuery.noConflict();

This preserves everything else, leaving the $ to work for you. And yes, as I said you in my previous comment, please use $(document).ready() event instead:

$(document).ready(function () {
    $('.button').raptorize({
        'enterOn' : 'konami-code'
    });
});

这篇关于$(...)。函数不是函数jQuery的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆