我必须在phonegap应用程序中显示动态弹出窗口。我使用Jquery mobile和javascript使弹出窗口动态化,但弹出窗口在整个应用程序中都有白色背景。 请帮我以正确的形式得到它。 Html代码:
<div id="popupMsgPage" data-role="popup" data-close-btn="right" data-theme="c" data-overlay-theme="c">
<div data-role="header" data-position="fixed" >
<h1 id="popup-head">Delete Page?</h1>
</div>
<div role="main" class="ui-content">
<h3 class="ui-title" id="popup-title">Are you sure you want to delete this page?</h3>
<p id="popup-content">This action cannot be undone.</p>
<a href="#" data-rel="back" data-rel-count="1" data-role="button" >Continue</a>
</div>
Jquery代码:
function show(head, title, msg) {
debugger;
head = head ? head : "";
title = title ? title : "";
msg = msg ? msg : "";
jPages["popupMsg"].find("#popup-head").html(head);
jPages["popupMsg"].find("#popup-title").html(title);
jPages["popupMsg"].find("#popup-content").html(msg);
$.mobile.changePage("#popupMsgPage", {
role: "dialog"
});
答案 0 :(得分:2)
我认为你正在混合弹出窗口小部件和对话框页面。如果您不想更改页面,请使用如下弹出窗口小部件:
function show(head, title, msg) {
head = head ? head : "";
title = title ? title : "";
msg = msg ? msg : "";
$("#popupMsgPage").find("#popup-head").html(head);
$("#popupMsgPage").find("#popup-title").html(title);
$("#popupMsgPage").find("#popup-content").html(msg);
$("#popupMsgPage").popup("open");
}
正在使用 DEMO