jQuery UI错误-f.getClientRects不是函数 [英] Jquery UI error - f.getClientRects is not a function
问题描述
我正在尝试使Jquery UI正常工作,但事实并非如此.这是发生了什么.我正在加载依赖项:
I'm trying to make Jquery UI work, but it doesn't. Here's what happens. I'm loading dependencies:
<script src="assets/src/js/angular/angular.js"></script>
<script src="assets/src/js/angular-animate/angular-animate.js"></script>
<script src="assets/src/js/angular-route/angular-route.js"></script>
<script src="assets/src/js/jquery/dist/jquery.js"></script>
<script src="assets/src/js/jquery-ui/jquery-ui.js"></script>
<script src="assets/src/js/app.js"></script>
<script src="assets/src/js/main.js"></script>
这是我的 main.js 文件:
$(function () {
$("input[type=submit]")
.button()
.click(function (event) {
event.preventDefault();
});
});
$(function () {
$("#circum").buttonset();
});
$(function () {
$("#dialog-message").dialog({
modal: true,
buttons: {
Ok: function () {
$(this).dialog("close");
}
}
});
});
当我在Brackets中运行代码时,Jquery UI已加载但不起作用,但是,当我注释掉main.js文件然后将其带回时,这是我在控制台中遇到的错误,并且UI突然开始工作.太不可思议了.
When I run the code in Brackets Jquery UI is loaded but doesn't work, however, when I comment my main.js file out and then bring it back that's the error I get in the console and UI is suddenly working. It's extremely weird.
jQuery.Deferred exception: elem.getClientRects is not a function TypeError: elem.getClientRects is not a function
at jQuery.offset (http://127.0.0.1:27530/assets/src/js/jquery/dist/jquery.js:9779:14)
at Object.getWithinInfo (http://127.0.0.1:27530/assets/src/js/jquery-ui/jquery-ui.js:1157:26)
at jQuery.$.fn.position (http://127.0.0.1:27530/assets/src/js/jquery-ui/jquery-ui.js:1179:23)
at _position (http://127.0.0.1:27530/assets/src/js/jquery-ui/jquery-ui.js:8709:17)
at ._position (http://127.0.0.1:27530/assets/src/js/jquery-ui/jquery-ui.js:415:25)
at open (http://127.0.0.1:27530/assets/src/js/jquery-ui/jquery-ui.js:8334:8)
at .open (http://127.0.0.1:27530/assets/src/js/jquery-ui/jquery-ui.js:415:25)
at _init (http://127.0.0.1:27530/assets/src/js/jquery-ui/jquery-ui.js:8210:9)
at ._init (http://127.0.0.1:27530/assets/src/js/jquery-ui/jquery-ui.js:415:25)
at _createWidget (http://127.0.0.1:27530/assets/src/js/jquery-ui/jquery-ui.js:587:8) undefined
我发现此线程正在讨论该问题,但仍无法解决.
I've found this thread discussing the issue but still wasn't able to fix it.
干杯.
推荐答案
您的jQuery UI是哪个版本?我在jQuery UI 1.11.4和jquery 3.0中遇到了相同的问题.安装jQuery UI 1.12.0-rc.2后,此问题已解决.
What version is your jQuery UI? I had the same issue with jQuery UI 1.11.4 and jquery 3.0. After installing jQuery UI 1.12.0-rc.2, the problem was fixed.
这篇关于jQuery UI错误-f.getClientRects不是函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!