jQuery 移动和弹出对话框

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

jQuery mobile and pop up dialog boxes

jquerymobiledialogjquery-mobile

提问by Fred Thomas

I need a pop up dialog box for my jQuery mobile app. I found this plug in:

我的 jQuery 移动应用程序需要一个弹出对话框。我找到了这个插件:

http://dev.jtsage.com/jQM-SimpleDialog/

http://dev.jtsage.com/jQM-SimpleDialog/

Which is awesome -- doing exactly what I need, but for one detail --it doesn't work correctly on the Android browsers I tried it on (all I get is a blank screen.) I suspect that the developer only tested on iPhone (perhaps an iPhone user could confirm if it works or not.)

这很棒- 完全按照我的需要做,但有一个细节 -它在我尝试过的 Android 浏览器上无法正常工作(我得到的只是一个空白屏幕。)我怀疑开发人员只在 iPhone 上进行了测试(也许 iPhone 用户可以确认它是否有效。)

Does anyone know of either a fix, or an alternative plug in that does the same sort of thing?

有没有人知道可以做同样事情的修复程序或替代插件?

采纳答案by Patrick Moore

If you are simply displaying information (no need for callback/response events) you can create a popup in this manner:

如果您只是显示信息(不需要回调/响应事件),您可以通过以下方式创建一个弹出窗口:

<script type="text/javascript">
$("<div class='ui-loader ui-overlay-shadow ui-body-e ui-corner-all'><h1><strong>Thank you, we have received your information.</strong></h1></div>")
    .css({ "display":"block", "opacity":0.96, "top": $(window).scrollTop() + 100 })
    .appendTo( $("body") )
    .delay( 2500 )
    .fadeOut( 400, function(){
        $(this).remove();
    });
</script>

回答by ?erban Ghi??

I'm having the same problem and I decided to use popup()function from jQuery Mobile 1.2 alpha: http://jquerymobile.com/demos/1.2.0-alpha.1/docs/pages/popup/index.html. Before this I used JQM Simple Dialog 2 http://dev.jtsage.com/jQM-SimpleDialog/demos2/.

我遇到了同样的问题,我决定使用popup()jQuery Mobile 1.2 alpha 中的函数:http: //jquerymobile.com/demos/1.2.0-alpha.1/docs/pages/popup/index.html。在此之前,我使用了 JQM 简单对话框 2 http://dev.jtsage.com/jQM-SimpleDialog/demos2/

This might help also:

这也可能有帮助:

I've also created a small plugin which wraps around jQuery Mobile popup()function to be able to call the popup much easier like $.dynamic_popup('Your HTML message');See http://ghita.org/jquery/dynamic-mobile-popupor the demo and screenshots at https://github.com/serbanghita/jQM-dynamic-popup

我还创建了一个包含 jQuery Mobilepopup()功能的小插件,以便能够更轻松地调用弹出窗口,例如$.dynamic_popup('Your HTML message');参见http://ghita.org/jquery/dynamic-mobile-popuphttps://的演示和屏幕截图github.com/serbanghita/jQM-dynamic-popup

Let me know if you find it useful.

如果您觉得它有用,请告诉我。

PS: works with jQM 1.3

PS:适用于 jQM 1.3