Html JQuery-mobile 弹出/对话框?

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

JQuery-mobile pop up/ dialog box?

htmldialogpopupjquery-mobile

提问by S. N

I am building an app for mobiles, using jquery mobile framework. I want to be able to make a simple dialog box/pop up, so that when you click on a picture of a "question mark" the pop up/ dialog box would appear with a simple message. I have tried different approaches from http://jquerymobile.com/test/docs/pages/dialog-alt.htmlto so many others. I couldnt get non of them to work. So If you know how to make a simple pop up or a simple dialog box could you please give me an example!

我正在使用 jquery 移动框架构建移动应用程序。我希望能够制作一个简单的对话框/弹出窗口,以便当您单击“问号”图片时,弹出/对话框会出现一条简单的消息。我尝试了从http://jquerymobile.com/test/docs/pages/dialog-alt.html到许多其他方法的不同方法。我不能让他们工作。所以如果你知道如何制作一个简单的弹出窗口或一个简单的对话框,请给我一个例子!

回答by LeftyX

If you want to open a dialog in jquery mobile you have to use an attribute data-rel="dialog"and the href must point to a URL where your dialog lives:

如果你想在 jquery mobile 中打开一个对话框,你必须使用一个属性data-rel="dialog",并且 href 必须指向你的对话框所在的 URL:

<a href="http://jquerymobile.com/test/docs/pages/dialog-alt.html" data-role="button" data-rel="dialog">Open dialog</a>

Here's a fiddleso you can see how it works.
Hope it helps.

这是一个小提琴,所以你可以看到它是如何工作的。
希望能帮助到你。

UPDATE:

更新:

It seems there's a problem with jQuery Mobile dialog and some devices. There's an issueopen in the GitHub repository.
I've found this pluginwhich seems to work really well.

jQuery Mobile 对话框和某些设备似乎存在问题。GitHub 存储库中存在一个未解决的问题
我发现这个插件似乎工作得很好。