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)在data-dismissible标记中定义popup的值。

标记
<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 });
});

Live example - updated

10-06 15:04