2015-10-16 68 views
-1

我有這個在cordova中的函數中創建的彈出窗口。jquery popup在cordova中打開後立即關閉iOS 9

var problem_list2 = new Array(); 
function addSymptom(symptom){ 
    $.ajaxSetup({ async: false}); 
    //$.mobile.loading('show'); 
    if($.inArray(symptom, problem_list2)===-1){ 
     problem_list2.push(symptom); 
     //var lis = problem_list2; 
     var $popUp = $("<div/>").popup({ 
      dismissible : true, 
      theme : "a", 
      overlayTheme : "a", 
      transition : "slide" 
     }).bind("popupafterclose", function() { 
      $(this).remove(); 
     }); 
     $("<h2/>", { 
      text : "Problem List" 
     }).appendTo($popUp); 
     for(var i=0;i<problem_list2.length;i++){ 
      $("<h4/>", {   
       text : problem_list2[i] 
      }).appendTo($popUp); 
     } 
     $('<input type="button" data-iconpos="right" data-icon="plus" value="Add More Symptoms" onclick="closer()">').appendTo($popUp); 
     $('<input type="button" data-iconpos="right" data-icon="check" value="Diagnose" onclick="diagnose()">').appendTo($popUp);   
     $popUp.popup("open").trigger("create");     
    } 
} 

當按下關閉按鈕,此功能關閉彈出:

function closer(){  
    $('.ui-popup').popup('close'); 
} 

它可以在任何網絡瀏覽器和科爾多瓦Android精品。但在cordova iOS 9中,彈出窗口在第一次打開時立即關閉。第一次保持打開狀態後,只有在首次打開時纔會出現此行爲。我嘗試添加數據的歷史=「假」是這樣的:

var problem_list2 = new Array(); 
function addSymptom(symptom){ 
    $.ajaxSetup({ async: false}); 
    //$.mobile.loading('show'); 
    if($.inArray(symptom, problem_list2)===-1){ 
     problem_list2.push(symptom); 
     //var lis = problem_list2; 
     var $popUp = $("<div data-history='false' />").popup({ 
      dismissible : true, 
      theme : "a", 
      overlayTheme : "a", 
      transition : "slide" 
     }).bind("popupafterclose", function() { 
      $(this).remove(); 
     }); 
     $("<h2/>", { 
      text : "Problem List" 
     }).appendTo($popUp); 
     for(var i=0;i<problem_list2.length;i++){ 
      $("<h4/>", {   
       text : problem_list2[i] 
      }).appendTo($popUp); 
     } 
     $('<input type="button" data-iconpos="right" data-icon="plus" value="Add More Symptoms" onclick="closer()">').appendTo($popUp); 
     $('<input type="button" data-iconpos="right" data-icon="check" value="Diagnose" onclick="diagnose()">').appendTo($popUp);   
     $popUp.popup("open").trigger("create");     
    } 
} 

和這樣:

var problem_list2 = new Array(); 
function addSymptom(symptom){ 
    $.ajaxSetup({ async: false}); 
    //$.mobile.loading('show'); 
    if($.inArray(symptom, problem_list2)===-1){ 
     problem_list2.push(symptom); 
     //var lis = problem_list2; 
     var $popUp = $("<div/>").popup({ 
      dismissible : true, 
      datahistory : 'false', 
      theme : "a", 
      overlayTheme : "a", 
      transition : "slide" 
     }).bind("popupafterclose", function() { 
      $(this).remove(); 
     }); 
     $("<h2/>", { 
      text : "Problem List" 
     }).appendTo($popUp); 
     for(var i=0;i<problem_list2.length;i++){ 
      $("<h4/>", {   
       text : problem_list2[i] 
      }).appendTo($popUp); 
     } 
     $('<input type="button" data-iconpos="right" data-icon="plus" value="Add More Symptoms" onclick="closer()">').appendTo($popUp); 
     $('<input type="button" data-iconpos="right" data-icon="check" value="Diagnose" onclick="diagnose()">').appendTo($popUp);   
     $popUp.popup("open").trigger("create");     
    } 
} 

回答

0

將數據歷史上的彈出DIV

+0

我想,在=「假」上面的編輯。沒有工作。 – user1518003