我正在使用 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.
提前谢谢.
推荐答案这已作为功能请求添加到 Github.查看问题这里.
This has been added as a feature request on Github. See issue here.
临时解决此问题的方法是取消绑定 ui-popup-screen 上的事件.我会把下面的代码放在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 关闭弹出窗口
发布评论