繁体   English   中英

jquery选项上的移动弹出窗口对话框不起作用

[英]jquery Mobile popup dialog dismissible on options doesn't work

jquerymobile 1.30 + jquery 1.91

//dismissible doesn't apply
 $("#popupDialogCategoriesButton").click(function (e) {
                $("#popupDialogCategories").popup("open", { dismissible: false })
            });


//dismissible does apply , set it after open
     $("#popupDialogCategoriesButton").click(function (e) {
            $("#popupDialogCategories").popup('open');
            $("#popupDialogCategories").popup("option", "dismissible", false);
            });

更新

为了打开popup和改变的值dismissible的同时,添加data-dismissible=""有没有价值/空白的popup标记,那么你可以将其更改为truefalse

标记

<div data-role="popup" id="popupBasic" data-dismissible="">
 <p>To close me, hit the button below.
 <p> <a href="#" data-role="button" data-rel="back">close</a>
</div>

JQM

$(document).on('click', '#openpopup', function () {
 $('#popupBasic').popup('open', { dismissible: false });
});

您有两种选择:

1)在popup标记中定义data-dismissible的值。

标记

<div data-role="popup" id="popupBasic" data-dismissible="false">
 <p>To close me, hit the button below.<p>
 <a href="#" data-role="button" data-rel="back">close</a>
</div>

<a href="#" data-role="button" id="openpopup">click me</a> // open it

JQM

$(document).on('click', '#openpopup', function() {
 $('#popupBasic').popup("open");
});

2)在打开之前/之后更改dismissible值。

标记

<div data-role="popup" id="popupBasic">
 <p>To close me, hit the button below.<p>
 <a href="#" data-role="button" data-rel="back">close</a>
</div>

<a href="#" data-role="button" id="openpopup">click me</a> // open it

JQM

$(document).on('click', '#openpopup', function() {
 $('#popupBasic').popup("open");
 $('#popupBasic').popup({ dismissible: false });
});

实例 - 更新

我遇到了同样的问题,我的解决方案是列出下面的所有选项

$("#popupDialog").popup({history: false});
$("#popupDialog").popup({corners: false});
$("#popupDialog").popup({shadow: false});
$("#popupDialog").popup("open"); 

这看起来并不好看,但运作良好。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM