2013-03-20 94 views
2

我要去试试这个没有方法:http://jquerytools.org/demos/scrollable/index.html
但是,如果没有任何事件触发,我m到处以下错误遗漏的类型错误:对象[对象对象]有“开”

enter image description here

但我有,困惑为什么方法甚至页面加载没有找到

<head> 
<link href="css/scrollable-horizontal.css" rel="stylesheet" type="text/css" /> 
<link href="css/scrollable-buttons.css" rel="stylesheet" type="text/css" /> 
<script src="js/jquery-1.6.1.min.js"></script> 
<script src="js/jquery.tools.min.js"></script> 
</head> 

没有在JavaScript部分

<script> 
$(function() { 
    // initialize scrollable 
    $(".scrollable").scrollable(); 
}); 
</script> 

它停在我的进一步实施完成。对此有任何想法?

回答

5

在1.7中添加了JQuery .on方法。您需要更新您的JQuery从你的截图中,你正在使用1.6

http://api.jquery.com/on/

一旦从here下载,改变凡注明

<head> 
<link href="css/scrollable-horizontal.css" rel="stylesheet" type="text/css" /> 
<link href="css/scrollable-buttons.css" rel="stylesheet" type="text/css" /> 
<script src="js/jquery-1.6.1.min.js"></script> <!-- Change this line --> 
<script src="js/jquery.tools.min.js"></script> 
</head> 
1

您正在使用jQuery 1.6.1下面 - on()当时并不存在(直到1.7)。

您的选择:

  • 无论您使用bind()代替。

  • 或者你更新到最新的jQuery。

至于第二个选项,更换

<script src="js/jquery-1.6.1.min.js"></script> 

<script src="http://code.jquery.com/jquery-latest.min.js" 
     type="text/javascript"></script> 
1

您需要更新jQuery的版本。

因为jQuery 1.6没有.on()它被添加到新版本的jQuery。

+0

@ down-voter为什么放弃投票.. – 2013-03-20 09:10:44

相关问题