有没有人知道我应该如何关闭具有淡入淡出效果的对话框,并仅在关闭后重新加载页面。不幸的是,location.reload立即发生而不等待对话框被关闭。
function show_dialog_ok()
{
$("#dialog_ok").text("Your message was sent");
$("#dialog_ok").dialog({
hide: {effect: "fade", duration: 2000}, modal: true
});
setTimeout(function() { $("#dialog_ok").dialog('close'); }, 2000);
location.reload();
}
答案 0 :(得分:1)
如何在timeOut
内关闭对话框的同时重新加载function show_dialog_ok() {
$("#dialog_ok").text("Your message was sent");
$("#dialog_ok").dialog({
hide: {effect: "fade", duration: 2000}, modal: true
});
setTimeout(function() {
$("#dialog_ok").dialog('close');
location.reload();
}, 2000);
}
答案 1 :(得分:0)
使用完整的回调在动画完成后调用reload:
function show_dialog_ok()
{
$("#dialog_ok").text("Your message was sent");
$("#dialog_ok").dialog({
hide: {
effect: "fade",
duration: 2000,
complete: function() {
location.reload();
}
}, modal: true
});
setTimeout(function() { $("#dialog_ok").dialog('close'); }, 2000);
}