2012-11-03 62 views
1

我正在用jQuery mobile開發一個Facebook應用程序,在那裏創建一個創建第二個對話框(鏈接)的對話框。jQuery Mobile中的鏈接對話框:第二個對話框在Android中消失

問題是,在Android和Opera中,第二個對話框顯示一秒鐘,然後消失。

有沒有辦法避免這種行爲? 否則,如何銷燬第一個對話框而不破壞第二個對話框?

CODE:

function function1(item) {   
     showDialog(..., function(){ 
       ... 
       if (appInstalled == true) {       
         if(function2(item) == true) { 
           //call to alert dialog function2 
         } 
       } 
     }); 
} 

function function2(item) { 
     if (...) { 
       showAlertDialog(item.name, messages.MATCH_CONFIRMATION_MSG, item.picture.data.url, '#friendsPage'); 
       $('#dialog').dialog('close'); 
       $('#alertDialogTrickLink').click();//this is event for going to dialog 
     } 

} 

function showDialog(title, content, img, hrefURL, hrefURLcancel, callbackFunction) { 
     $('#dialog-content').html(content); 
     $('#dialogHeader').text(title); 
     if (img != null) { 
       $('#dialog-img').html('<img src="' + img +'" alt="" class="bigImg" />'); 
     } else { 
       $('#dialog-img').html(''); 
     } 
     var a = messages.ACCEPT_BUTTON_TEXT; 
     var c = messages.CANCEL_BUTTON_TEXT; 
     $('#dialogActions').html(
       '<a href="' + hrefURL + '" data-role="button" data-theme="c" id="confirmDialogAction" data-icon="check" data-iconpos="left">' + a + '</a>' +  
       '<a href="' + hrefURLcancel + '" data-role="button" id="skipDialogAction" data-icon="delete" data-iconpos="left">' + c + '</a>' 
     ); 
     $('#confirmDialogAction').click(function(e) { 
       e.preventDefault(); 
       callbackFunction(); 
     }); 
     $('#dialog').trigger('create'); 
} 

感謝磨

+1

你可以提供一個小例子中setTimeout的方法呢? – Taifun

+0

嗨,泰富。剛編輯過的代碼不起作用。謝謝! – Arturo

回答