2015-05-14 44 views
2

我在PhoneGap的appliction.I作出的彈出窗口的動態使用jQuery Mobile和JavaScript,但彈出顯示動態彈出窗口在整個應用白色背景。 請幫助我以正確的格式獲取此內容。 HTML代碼:jQuery Mobile的對話框不改變

<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" 

     }); 

回答

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

+0

我得到了像「不能呼籲在初始化之前彈出方法是錯誤的;試圖調用方法'open'「,然後我調用了這個 - 」$(「#popupMsgPage」)。popup();「之前「$(」#popupMsgPage「)。popup(」打開「);」它正在工作。 謝謝。 –

+0

@Auurag_Panday,如果你使用pagecreate這樣的頁面事件,那麼彈出窗口就已經被初始化了。見$(文件)。在(「pagecreate」,「#第1頁」 ......部分撥弄。 – ezanker

+0

當我methods.no頭上面使用什麼其他的選擇,我可以代替pagecreate.Popup UI的使用得到改變和其他變薄在彈出的對話框 –