【问题标题】:Chaining dialogs in jQuery mobile: second dialog disappears in AndroidjQuery mobile 中的链接对话框:第二个对话框在 Android 中消失
【发布时间】:2012-10-23 22:06:06
【问题描述】:

我正在使用 jQuery mobile 开发一个 Facebook 应用程序,我在其中创建了一个用于创建第二个对话框(链接)的对话框。

问题在于,对于 Android 和 Opera,第二个对话框会显示一秒钟,然后消失。

有没有办法避免这种行为? 否则,如何在不破坏第二个对话框的情况下破坏第一个对话框?

代码:

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

谢谢你

【问题讨论】:

  • 你能提供一个小例子吗?
  • 您好泰丰。刚刚用不起作用的代码进行了编辑。谢谢!

标签: android jquery facebook jquery-mobile jquery-chaining


【解决方案1】:

您是否尝试过此处描述的setTimeout 方法Note: Chaining of popups not allowed

【讨论】:

    猜你喜欢
    • 2014-05-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-01-27
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多