2013-03-20 99 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

相關問題