javascript 混合 JQuery Mobile 和 JQuery UI

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

Mixing JQuery Mobile & JQuery UI

javascriptjquery-uijquery-mobile

提问by ic3

We're thinking to combine JQuery UI and Mobile. Does somebody has some experience with this ?

我们正在考虑将 JQuery UI 和 Mobile 结合起来。有人有这方面的经验吗?

Past experience is proving tricky jquery forum, but it's a bit old.

过去的经验证明jquery 论坛很棘手,但它有点老了。

Any sharing of experience and ideas is welcomed.

欢迎任何经验和想法的分享。

Some experience using the JQuery Mobile virtual events ?

使用 JQuery Mobile 虚拟事件的一些经验?

Thanks

谢谢

回答by zmechanic

The current version of jQuery UI 1.10.4 and jQuery Mobile 1.4.2 do not play well together. Styles in Mobile are ruined as soon as you include jQuery UI into your page.

当前版本的 jQuery UI 1.10.4 和 jQuery Mobile 1.4.2 不能很好地协同工作。一旦将 jQuery UI 包含到页面中,Mobile 中的样式就会被破坏。

However, if you need only particular functionality from jQuery UI, as in my case I only need Draggable/Droppable/Sortable interactions, you can create custom jQuery UI download at https://jqueryui.com/download/and include interactions only. Then you can simply delete everything except js/jquery-ui-1.10.4.custom.min.js file and all works well together again.

但是,如果您只需要来自 jQuery UI 的特定功能,就像在我的情况下我只需要 Draggable/Droppable/Sortable 交互,您可以在https://jqueryui.com/download/创建自定义 jQuery UI 下载并仅包含交互。然后您可以简单地删除除 js/jquery-ui-1.10.4.custom.min.js 文件之外的所有内容,并且所有内容再次正常运行。

I expect you'll run into issues using jQuery UI widgets even using this approach. But, it makes sense to use jQuery Mobile stuff only.

我希望即使使用这种方法,您在使用 jQuery UI 小部件时也会遇到问题。但是,只使用 jQuery Mobile 的东西是有意义的。

回答by Rayraegah

If you are targeting tablets and only tablets then this shouldn't be a problem. Just treat JQM as a Jquery plugin and JQuery UI as another plugin.

如果您的目标是平板电脑并且只针对平板电脑,那么这应该不是问题。只需将 JQM 视为 Jquery 插件,将 JQuery UI 视为另一个插件。

Its possible you'll run into some UI errors, but it can be fixed. We've worked on an Enterprise Application for one of our clients using JQM and Jquery UI (for the datagrid and a few goodies) and High-charts. The target platform was iPad.

您可能会遇到一些 UI 错误,但可以修复。我们已经使用JQM 和 Jquery UI(用于数据网格和一些好东西)和 High-charts为我们的一个客户开发了一个企业应用程序。目标平台是 iPad。

EDIT: Its not an easy process, but you "can" make it work.

编辑:这不是一个简单的过程,但你“可以”让它工作。