2012-02-03 61 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