简体   繁体   中英

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

Update

In order to open the popup and change the value of dismissible at the same time, add data-dismissible="" with no value/blank to the popup markup, then you can change it to either true or false .

Markup

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

You have two options:

1) To define the value of data-dismissible in the popup markup.

Markup

<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) Change dismissible value before/after opening it.

Markup

<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

I got the same problem and my solution is to list all the options down below

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

It's not good looking but working well.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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