错误 jquery-ui 可拖动无法读取属性 'msie'

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/14366322/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-26 13:31:00  来源:igfitidea点击:

Error jquery-ui draggable Cannot read property 'msie'

jqueryjquery-uijquery-ui-draggable

提问by Thyago Quintas

I got some troubles to make work jquery-ui draggable. I will share with you my solution, this is the best solution?

我在使工作jquery-ui 可拖动方面遇到了一些麻烦。我将与您分享我的解决方案,这是最好的解决方案吗?

I just insert this to test before I start my real work.

我只是在开始真正的工作之前插入这个来测试。

<script src="http://code.jquery.com/jquery-latest.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.24/jquery-ui.min.js"></script>

and

  $('img').draggable();

Like here: http://jsbin.com/eqowet/2/

喜欢这里:http: //jsbin.com/eqowet/2/

But I got a error:

但我得到了一个错误:

Error: Uncaught TypeError: Cannot read property 'msie' of undefined.

错误:未捕获的类型错误:无法读取未定义的属性“msie”。

回答by roman m

msie is the flag on the jQuery.browserproperty

msie 是jQuery.browser属性上的标志

jQuery.browserwas deprecated since version 1.3 and was removed in jQuery 1.9.0

jQuery.browser自 1.3 版已弃用,并在 jQuery 1.9.0 中移除

Since you're using the latest version of hosted jQuery, your library was auto-upgraded to 1.9.0 hence the error.

由于您使用的是最新版本的托管 jQuery,您的库已自动升级到 1.9.0,因此出现错误。

As you've already realized, reverting back to 1.8.3 (or earlier version) fixes the issue; the real solution, however, is to stop using jQuery.browser

正如您已经意识到的那样,恢复到 1.8.3(或更早版本)可以解决此问题;然而,真正的解决方案是停止使用jQuery.browser

回答by Thyago Quintas

I try a lot of examples but all isn't working, just the same message, that I realized the version 1.8.24 isn't compatible with the last jQuery version. I have changed for it and voilà is working now.

我尝试了很多示例,但都不起作用,只是同样的消息,我意识到版本 1.8.24 与最新的 jQuery 版本不兼容。我已经改变了,瞧现在工作。

<script src="http://code.jquery.com/jquery-1.8.3.min.js"></script>

Like here: http://jsbin.com/eqowet/3/

像这里:http: //jsbin.com/eqowet/3/

回答by dstonek

You can use migrate.js to get compatibility

您可以使用 migrate.js 来获得兼容性

http://blog.jquery.com/2013/02/16/jquery-migrate-1-1-1-released/

http://blog.jquery.com/2013/02/16/jquery-migrate-1-1-1-released/

回答by Sergey Onishchenko

Got the same error with "sortable". So, make sure that all dependant scripts are included, also should be the right sequence.

“可排序”也有同样的错误。因此,请确保包含所有依赖脚本,也应该是正确的顺序。

jquery.min.js
jquery.ui.core.js
jquery.ui.sortable.min.js

For example to make it work on Joomla you may do like this:

例如,要使其在 Joomla 上运行,您可以这样做:

$doc =& JFactory::getDocument();
$doc->addScript('/media/jui/js/jquery.min.js');
$doc->addScript('/media/jui/js/jquery.ui.core.js');
$doc->addScript('/media/jui/js/jquery.ui.sortable.min.js');

回答by genkilabs

I got this error for an older version of jquery mobile. If you are using an old JQM, you need to update. If you are on Rails you can use the jqueryhttps://github.com/tscolari/jquery-mobile-rails

我在旧版本的 jquery mobile 上遇到了这个错误。如果您使用的是旧的 JQM,则需要更新。如果你在 Rails 上,你可以使用 jquery https://github.com/tscolari/jquery-mobile-rails

If you use the rails gem right now, be sure to get the 1.3 beta 1 to get this fix:

如果您现在使用 rails gem,请确保获取 1.3 beta 1 以获取此修复程序:

gem 'jquery_mobile_rails', "~> 1.3.b1"