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
标记,然后可以将其更改为true
或false
。
标记
<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