javascript-选项上可忽略的jquery移动弹出对话框不起作用
作者:互联网
的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);
});
解决方法:
更新资料
为了打开弹出窗口并同时更改dismissible的值,请在弹出标记中添加没有值/空白的data-dismissible =“”,然后将其更改为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的值.
标记
<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)在打开之前/之后更改允许值.
标记
<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 });
});
标签:jquery-mobile,javascript 来源: https://codeday.me/bug/20191031/1973370.html