jQuery.ui.draggable.js和jQuery.ui.widget.js冲突

Dan*_*l S 12 javascript jquery jquery-ui

我有一个工作的应用程序,它使用一个jquery ui对话框.我想让对话框可拖动.据我所知,唯一需要的是jquery.ui.draggable.js脚本.所以我将它添加到我正在使用的脚本中,但是知道我收到以下错误(如firebug控制台中所示):base不是构造函数jquery.ui.widget.js中的相关行是:

var basePrototype = new base(); 
Run Code Online (Sandbox Code Playgroud)

这就是我添加所有脚本的方式:

<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>
Run Code Online (Sandbox Code Playgroud)

难道我做错了什么?或者这是jquery的问题?

在此先感谢您的帮助

Aar*_*ron 46

问题是draggable扩展了$ .ui,mouse,并且包含在UI 1.7x中的ui核心文件中.

您需要在draggable之前包含jquery.ui.mouse.js,这样才能解决问题.


Poi*_*nty 2

您可能应该访问 jQuery UI 站点并为您自己构建所需的 jQuery UI 组件的“自定义”包装。然后您只需担心一个脚本(好吧,加上 jQuery 本身)。