防止JQuery Mobile在用户点击弹出窗口时关闭其弹出窗口

编程入门 行业动态 更新时间:2024-10-28 20:22:29
本文介绍了防止JQuery Mobile在用户点击弹出窗口时关闭其弹出窗口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正在使用JQuery Mobile 1.2.0 alpha 1.

I'm using JQuery Mobile 1.2.0 alpha 1.

当前,当我打开一个弹出窗口并在屏幕上任意位置点击它的外部时,弹出窗口将被关闭. 我想知道是否有我可以设置的JQuery Mobile属性,可以防止在外部点击时关闭弹出窗口? (模式弹出窗口)

Currently, when I open a popup and tap outside of it anywhere on the screen the popup is being closed. I was wondering if there's any JQuery Mobile attribute I have missed which can be set and prevent closing the popup upon outside-tap? (modal popup)

(有关弹出式窗口的文档,可以找到这里)

(The documentation for popups can be found here)

我有解决此问题的想法,但仍然无法实现它:

I had an idea of solving this but still can't implement it to work:

当显示一个JQM弹出窗口时,会有一个div覆盖ui-popup-screen类的所有屏幕.我想过要给它一个大的z-index并从中取消所有单击/点击功能的绑定.这样做并不能解决我的问题,但我想这是朝这个方向迈出的一小步.

When a JQM popup show up theres a div which covers all of the screen with class of ui-popup-screen. I thought somehow to give it a large z-index and unbind all click/tap function from it. Doing this does not solve my problem but I guess it is a small step in the direction.

提前Thnx.

推荐答案

已作为功能请求添加到Github.参见问题此处.

This has been added as a feature request on Github. See issue here.

为此,在此过程中,可以取消ui-popup屏幕上的事件的绑定.我会将以下代码放在pageinit中.

As a hack for this in the interim is to unbind the events on the ui-popup-screen. I would put the following code in the pageinit.

$("#yourPopupId").on({ popupbeforeposition: function () { $('.ui-popup-screen').off(); } });

这是一个繁琐的快速修复程序,但是可以使用.

This is a heavy handed quickfix, but it works.

更多推荐

防止JQuery Mobile在用户点击弹出窗口时关闭其弹出窗口

本文发布于:2023-08-06 02:17:28,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1309469.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:弹出窗口   用户   JQuery   Mobile

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!