2012-08-10 73 views
0

我正尝试将wipetouch插件集成到我的作品集http://www.i-jp.nl中,目前没有成功。Uncaught TypeError:Object [object Object] has no method'wipetouch'

铬给了我以下错误:

Uncaught TypeError: Object [object Object] has no method 'wipetouch'

我想不通的问题。以下是调用wipetouch的代码,位于slider.js中:

$(document).wipetouch({ 
       wipeLeft: function(result) { 
        //if (slide >= 0 && slide < 3){ 
         //$(".slider").animate({"right": "+=320px"}, "slow"); 
         //slide = slide + 1; 
        //}; 
        alert('test'); 
       }, 
      }); 
+0

是你包括插件?即:''。 – 2012-08-10 12:05:35

+1

问题是,你正在加载**两个**不同的jQuery版本,'1.8.0'和'1.7.2'。该插件附加到'jQuery.fn',它是'1.7.2'版本,而不是'$'。看到后来包含的版本('1.7.2')调用'jQuery.noConflict();',它将'$'恢复为指向早期包含的版本。为什么你要加载jQuery两次? – 2012-08-10 12:07:08

+0

是插件在标记之前被调用 – 2012-08-10 12:08:26

回答

3

您有jQuery加载两次。这导致与wipetouch方法不可用的问题。

至于修复。我会尝试删除代码中的第二个jQuery文件引用

这里是费利克斯·克林的一些信息提供:

The problem is that you are loading two different jQuery versions, 1.8.0 and 1.7.2 . The plugin attaches to jQuery.fn which is the 1.7.2 version, not $ . Is see that the later included version (1.7.2) calls jQuery.noConflict(); , which reverts the $ to point to the earlier included version.

您是第11行第一次装载的jQuery:

<script src="http://code.jquery.com/jquery-latest.js"></script> 

然后再上线18:

<script type='text/javascript' src='http://i-jp.nl/wp-includes/js/jquery/jquery.js?ver=1.7.2'></script> 
+0

该插件已绝对加载。 – 2012-08-10 12:08:47

+0

@FelixKling当我查看萤火虫中的脚本时,它并不适合我,这很奇怪。 – Undefined 2012-08-10 12:09:38

+0

它在Chrome浏览器:) – 2012-08-10 12:10:26

相关问题