我正在使用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');
}
谢谢磨
最佳答案
您是否尝试过此处描述的setTimeout
方法Note: Chaining of popups not allowed