javascript jQuery UI - 未捕获的类型错误:对象函数 (a,b){return new e.fn.init(a,b,h)} 没有方法“对话框”
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/8627853/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
jQuery UI - Uncaught TypeError: Object function (a,b){return new e.fn.init(a,b,h)} has no method 'dialog'
提问by Luke
I have a problem using jQuery ui and dialog()
function:
我在使用 jQuery ui 和dialog()
函数时遇到问题:
Uncaught TypeError: Object function (a,b){return new e.fn.init(a,b,h)} has no method 'dialog'
未捕获的类型错误:对象函数 (a,b){return new e.fn.init(a,b,h)} 没有方法“对话框”
I've googled around many people with the same problem solved that issue with a correct inclusion of jQuery library.
我搜索了很多有同样问题的人,通过正确包含 jQuery 库解决了这个问题。
This is the header: http://pastebin.com/e1cTKGK9
这是标题:http: //pastebin.com/e1cTKGK9
And this is the gpf1.js source: http://pastebin.com/0jXhU503
这是 gpf1.js 源:http://pastebin.com/0jXhU503
回答by dotslashlu
In line 48 in your gpf1.js file
在 gpf1.js 文件的第 48 行
$.dialog();
This $.
sign applies the dialog method to the whole jquery element. you should use the dialog method to a DOM element you want like:
这个$.
标志将 dialog 方法应用于整个 jquery 元素。你应该对你想要的 DOM 元素使用 dialog 方法:
$(foo).dialog()
And here's part of the DEMO from jqueryui.com.
这是 jqueryui.com 的演示的一部分。
$(function() {
$( "#dialog" ).dialog();
});
</script>
<div class="demo">
<div id="dialog" title="Basic dialog">
<p>This is the default dialog which is useful for displaying information. The dialog window can be moved, resized and closed with the 'x' icon.</p>
</div>
</div>
回答by dotslashlu
This can be fixed with the snippet bellow
这可以通过下面的代码段修复
// http://bugs.jquery.com/ticket/11921
if(! $.isFunction($.fn.curCSS)) {
$.curCSS = $.css;
$.fn.curCSS = $.fn.css;
var mouseY, lastY = 0;
}