使用 jquery mobile 的透明模式对话框
我正在尝试使用 jquery mobile rc2 创建模式对话框。
这是我的代码:
<div id="info" data-role="page" data-fullscreen="true">
<div data-role="content">
Info
<a data-role="button" data-rel="dialog" href="#dialog" >Dialog</a>
</div>
</div>
<div id="dialog" data-role="page" data-fullscreen="true">
<div data-role="content">
<p>This is Page 2</p>
</div>
</div>
正如您所看到的,没有 javascript 代码,因为 jqm 应该自动处理这个问题。
对话框看起来很漂亮,但背景变暗了。我只想在页面正常背景上显示对话框。 我该怎么办?有可能吗?我没有找到任何关于此的文档,但我认为这是一个相当常见的问题......
如果可以的话请帮忙!
i'm trying to create a modal dialog with jquery mobile rc2.
This is my code:
<div id="info" data-role="page" data-fullscreen="true">
<div data-role="content">
Info
<a data-role="button" data-rel="dialog" href="#dialog" >Dialog</a>
</div>
</div>
<div id="dialog" data-role="page" data-fullscreen="true">
<div data-role="content">
<p>This is Page 2</p>
</div>
</div>
As you can see there is no javascript code as jqm is supposed to handle this automatically.
The dialog looks beautiful but the background goes dark. I want to show just the dialog over my page normal background.
What am i supposed to do? Is it even possible? I didn't find any piece of documentationa about that, but it is a quite common problem i think...
Please help if you can!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您可以使用 jquery ui 创建一个可以是模式或非模式的 dialog。
我知道这不是您正在寻找的东西,但请尝试一下。
You can use jquery ui to create a dialog that can be either modal or not.
I know this is not what you are searching for exactly but give it a try.
我认为你最好的选择可能是使用 actionsheet 插件: https://github.com/ hiroprotagonist/jquery.mobile.actionsheet#readme
我发现它工作得相当好,希望他们能将其应用到未来的 jquery 移动版本中。单击深色背景中的链接时要小心。我还没弄清楚如何用这个插件关闭它们。
I think your best bet might be to use the actionsheet plugin: https://github.com/hiroprotagonist/jquery.mobile.actionsheet#readme
I find it works fairly well and hopefully they'll role that into a future jquery mobile release. Be careful about clicking on links in the darkened background. I haven't figured out how to turn those off with this plugin.
经过长时间的深入搜索,我发现 这个问题与我的类似。即使它不能正确处理嵌套对话框,它也可以解决问题。
希望 jQuery Mobile 团队能够在正式发布之前解决这个问题!
After long exaustive deeper search i found this question that is similar to mine. It solves the problems even if it does not handle nested dialogs correctly.
Hope jQuery Mobile team will solve this before official release!