我正在尝试将wipetouch插件集成到我的产品组合中http://www.i-jp.nl ,目前还没有成功。
Chrome 给出以下错误:
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');
},
});
最佳答案
您的 jQuery 加载了两次。这导致 wipetouch
方法不可用的问题。
至于修复。我会尝试删除代码中的第二个 jQuery 文件引用。
以下是 Felix Kling 提供的更多信息:
The problem is that you are loading two different jQuery versions,
1.8.0
and1.7.2
. The plugin attaches tojQuery.fn
which is the1.7.2
version, not$
. Is see that the later included version (1.7.2
) callsjQuery.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>
关于javascript - 未捕获的类型错误 : Object [object Object] has no method 'wipetouch' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11901131/