2010-04-07 157 views
11

我有一個工作的應用程序,它使用jQuery UI對話框。我想讓對話框可以拖動。據我所知,唯一需要的是jquery.ui.draggable.js腳本。所以我將它添加到我正在使用的腳本中,但知道我收到以下錯誤(如螢幕控制檯所示):base不是構造函數 jquery.ui.widget.js中的相關行是:jQuery.ui.draggable.js和jQuery.ui.widget.js衝突

var basePrototype = new base(); 

這是怎麼了將所有的腳本:

<script type="text/javascript" src="/media/development-bundle/jquery-1.4.2.js"></script> 
<script type="text/javascript" src="/media/development-bundle/ui/jquery.ui.core.js"></script> 
<script type="text/javascript" src="/media/development-bundle/ui/jquery.ui.widget.js"></script> 
<script type="text/javascript" src="/media/development-bundle/ui/jquery.ui.draggable.js"></script> 
<script type="text/javascript" src="/media/development-bundle/ui/jquery.ui.position.js"></script> 
<script type="text/javascript" src="/media/development-bundle/ui/jquery.ui.autocomplete.js"></script> 
<script type="text/javascript" src="/media/development-bundle/ui/jquery.ui.dialog.js"></script> 

難道我做錯了什麼?或者這是與jQuery的問題?

預先感謝任何幫助

+0

這應該有助於未來: http://stackoverflow.com/questions/10395996 – 2012-05-02 13:10:51

回答

2

你也許應該去jQuery UI的網站,並建立自己的需要了jQuery UI組件的「定製」的包裝。然後你只需要擔心一個腳本(好吧,加上jQuery本身)。

42

問題是,可拖動的擴展名爲$ .ui,鼠標,它包含在UI 1.7x中的UI核心文件中。

您需要在可拖動前包含jquery.ui.mouse.js,這將解決問題。

+1

謝謝亞倫。有用。 jquery.ui.mouse放在可拖拽後出現的問題。放置它之前解決了錯誤。 – swan 2010-11-19 14:20:32

+0

這也適用於我 – 2012-05-01 07:45:13

+0

非常感謝你! – schglurps 2012-06-07 07:53:07