2012-02-03 59 views
0

的我已经使用3 jQuery的一些相关文件,即jQuery的easeOutBounce功能缺失的,尽管包括jQuery的文件

<script type="text/javascript" src="/blog/jquery/jquery-1.7.1.min.js"></script> 
<link type="text/css" href="/blog/css/jquery-ui-1.8.17.custom.css" rel="stylesheet" /> 
<script type="text/javascript" src="/blog/jquery/jquery-ui-1.8.17.custom.min.js"></script> 

我现在想用Humanmsg jQuery插件。它有2 jquery的文件humanmsg.js的jquery.js
我已经有最新版本的jquery,所以我没有从插件中包含jquery.js文件。现在我在Chrome中遇到错误未捕获的TypeError:对象#没有方法'easeOutBounce'jquery-1.7.1.min.js:4
我已经检查过这个函数存在于jquery-ui-1.8.17 .custom.min.js但仍然浏览器不读取此文件,尽管显示错误文件jquery-1.7.1.min.js。 虽然插件正在工作,当我替换原始文件jquery-1.7.1.min.js与人工插件脚本文件(jquery.js),但网站的其余功能取决于orignal脚本文件,所以无法取代它。
任何想法(去除问题)/做法(包括来自第三方的各种脚本文件时要遵循)。 PS:humanmsg.js使用jQuery而不是$(如果它有任何用处)。
所有脚本文件都由浏览器完全下载。

下面是代码:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml"> 
<html> 
<head> 
    <script type="text/javascript" src="/var/www/blog/jquery/jquery-1.7.1.min.js"></script> <!--ORIGNAL--> 
    <link type="text/css" href="/var/www/blog/css/jquery-ui-1.8.17.custom.css" rel="stylesheet" /> 
    <script type="text/javascript" src="/var/www/blog/jquery/jquery-ui-1.8.17.custom.min.js"></script> 

    <!--script type="text/javascript" src="jquery.js"></script--> <!--Plugin jquery file--> 
    <script type="text/javascript" src="humanmsg.js"></script> 
    <link href="humanmsg.css" media="screen" type="text/css" rel="stylesheet"> 
    <title>Humanized Messages - Demo</title> 
    <script> 
    jQuery(document).ready(function() { 
     jQuery('a.showmessage').click(function() { 
      humanMsg.displayMsg('<strong>Success:</strong> <span class="indent">You clicked \''+jQuery(this).text()+'\'</span>'); 
      return false; 
     }) 

     jQuery('a.showmessage:last').click(function() { 
      humanMsg.displayMsg('"Your <strong>Earth</strong> will be reduced to a burned-out cinder."'); 
      return false; 
     }) 
    }) 
    </script> 
</head> 

<body> 
    <p class="links"> 
     <a href="#" class="showmessage">Click Me to show message</a> 
    </p> 
</body> 
</html> 

编辑:


我发现Gritter,很好的替代了humanmsg及其工作正常使用jQuery的最新版本。

回答

0

你的问题是,插件,Humanmsg,is more than 4 years old和你使用jQuery 1.7.1版本。

发生了很多jQuery的内自1.1版本改变。展望Humanmsg,揭示各种被取代的方法。例如,使用.bind,其中jQuery 1.7更喜欢新的.on method

你必须找到更是最新的插件,因为我不会建议使用jQuery 1.1与今天的浏览器。

你可以尝试添加宽松插件,或者just the one easing function,但你仍然有你的插件存在方式的更大的问题已经过时了。

+0

恐怕你说得对。你能建议任何相当于人性化的东西吗? – Terminal 2012-02-03 17:59:13

+0

@Terminal,我真的不确定你的需求或者这个插件应该做什么。这只是少量的代码。逐行浏览它,更新它以使用当今版本的jQuery。另请参阅上面关于仅使用单个缓动函数而不使用插件的链接......您可以轻松地构建一个缓动函数。已经有了 – Sparky 2012-02-03 18:10:41

+0

。谢谢。 – Terminal 2012-02-03 18:13:32

1

documentation为你的插件:

Humane Messages requires the jQuery javascript library. Also recommended, but not required, is the jQuery plugin, Easing ; to give just the right bounce to the animations.

他们使用的宽松插件是http://gsgd.co.uk/sandbox/jquery/easing/,我不明白,你已经包括在内。

+0

正如他已经陈述的,他使用jQuery UI和[它已经包括缓解](http://jqueryui.com/demos/effect/easing.html)函数。你可以在这里看到'easeOutBounce' [在jQuery UI中](https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/jquery-ui.js)。 – Sparky 2012-02-03 17:45:28

+0

@ Sparky672 - 然而,该插件的文档根本没有提到jQuery UI。我意识到jQuery UI已经融入了(现在),但是基于这个插件的年龄,我怀疑它使用了它,并且它推荐了其他的easing插件。 – j08691 2012-02-03 17:48:35

+0

它没有提到jQuery UI,因为jQuery UI可能不存在(最初于2007年9月发布),当它被编写时...该插件是一个恐龙,并且无论他包含什么其他东西,该插件都可能无法工作。 – Sparky 2012-02-03 17:49:56