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

时间:2013-03-15 15:16:03

标签: javascript jquery-mobile

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

2 个答案:

答案 0 :(得分:4)

<强>更新

要打开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

答案 1 :(得分:0)

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

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

看起来不太好但是运作良好。