jQuery Mobile 弹出窗口和对话框 [英] jQuery Mobile Popups and Dialogs

查看:25
本文介绍了jQuery Mobile 弹出窗口和对话框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

jQuery mobile 1.2 alpha 引入了 Popups,而它已经有一个类似的小部件,称为 Dialogs.它们在性质上看起来非常相似.

jQuery mobile 1.2 alpha introduces Popups while it already has a similar widget, called Dialogs. They both seem very similar in nature.

弹出窗口和对话框之间的技术区别是什么?

What are the technical differences between Popups and Dialogs?

弹出窗口可以做什么(任何实际用例作为首选示例)对话框是不可能的?

What Popups can do (any practical usecase as example preferred) that is impossible with Dialogs?

推荐答案

它们是完全不同的野兽.以下是我基于我有限的经验的看法.

They are quite different beast. Here is my opinion based on my limited experience.

对话

Dialogues

  • 对话接管页面,它们包含全屏深色背景,以使对话"看起来已经取代了页面.

  • Dialogues take over the page, they contain a fullscreen dark background to make the "dialog" appear to have replaced the page.

通过将 data-rel="dialog" 属性添加到页面锚链接,任何页面都可以显示为对话框.

Any page can be presented as a dialog by adding the data-rel="dialog" attribute to the page anchor link.

与页面一样,您可以通过将 data-transition 属性添加到链接来指定对话框中所需的任何页面转换.

Like pages, you can specify any page transition you want on the dialog by adding the data-transition attribute to the link.

可以串起来.

弹出窗口

  • 在当前页面中显示,可能更类似于通常称为模态框或灯箱的功能.

  • Displays within the current page, and are probably more similar to the functionality commonly referred to as modals or lightboxes.

不能被链接.

弹出窗口可能更适合警报、工具提示、小的是/否"确定/取消消息、将缩略图弹出到更大的图像、小型 ajax 表单(时事通讯、登录、发表评论)等.当您不这样做时很有用不想让信息超载页面,并且只想在用户需要或请求时向他们展示某些功能.

Popups are probably more suited for alerts, tooltips, small yes/no ok/cancel messages, making a thumbnail popup into a larger image, small ajax forms(newsletter, login, post a comment) etc. Useful when you don't want to overload the page with information, and only want to reveal certain functionality to users when they need or request it.

另一方面,对话可用于需要传达大量信息(条款和条件接受屏幕等)的情况,或者当您确实想强调警报、菜单、用户的选择时,等等.对话会破坏页面的流程,所以应该更加谨慎地使用.

Dialogues on the other hand could be used in situations where you need to convey a lot of information (terms and conditions acceptance screen, etc), or when you really want to emphasis an alert, menu, the choice a user has, etc. Dialogues kind of break the flow of a page so should be used more cautiously.

弹出窗口的一个巧妙功能是它们可以用作覆盖面板,可以用来创建从屏幕一侧滑入的菜单,与 Facebook 的 iphone 应用程序中的菜单没有太大不同.

One neat feature of the popups is that they can be used as overlay panels, which could be used to create a menu that slides in from the side of the screen, not too dissimilar to the menu in the Facebooks iphone application.

归根结底,任何一个都可以使用,没有对错之分,很大程度上取决于个人喜好,以及您希望应用程序如何进行.

At the end of the day, either could be used, and neither is right or wrong, a lot of it comes down to personal preference, and how you want your application to flow.

这篇关于jQuery Mobile 弹出窗口和对话框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆