[英]jquery ui dialog, open new dialog and close dialog behind
“我的網站”的頁腳可打開4個不同的對話框,並從獨立頁面將內容加載到其中。
如果您從搜索引擎輸入頁腳頁面或輸入網址,則可以單獨打開頁腳頁面。
我有一個打開頁腳對話框的功能:
function FooterPopup(){
$(document).ready(function(){
$('#footerContactUs').on("click",function(){
var $dialog=$('<div></div>').load($('#footerContactUs').attr('href')).dialog({
close: function(event,ui){$(this).remove ();},
autoOpen:false,
width:700,
height:610,
resizable:'false',
modal:true,
show:'blind',
hide:{effect:'blind',duration:300},
dialogClass:'Contact'
});
$dialog.dialog('open');
return false;
});
})
}
獨立頁面的鏈接會打開另一個功能不同的對話框,
所以我有兩種情況 :
1.dialog在另一個對話框的頂部打開。
2.dialog從一個獨立頁面打開。
碼:
function Consult(){
$(document).ready(function(){
$('.ConsultHotels').on("click",function(){
var $dialog=$('<div></div>').load($('.ConsultHotels').attr('href')).dialog({
modal:true,
close: function(event,ui){$(this).remove();
$('.ui-datepicker').remove();},
autoOpen:false,
width:750,
height:590,
resizable:'false',
show:'blind',
hide:{effect:'blind',duration:300},
open:function(event,ui){$('body').find('.ui-dialog-content').eq(0).dialog("close");},
dialogClass:'ConsultClass'
});
$dialog.dialog('open');
return false;
});
});
}
我的問題是我不知道如何從第一種情況下關閉“父”對話框而不在第二種情況下關閉對話框。
請幫忙,
謝謝。
為什么在打開新對話框之前不只是關閉任何打開的對話框?
$('.ConsultHotels').on("click",function(){
// first close any open dialogs. This approach is used in stead of just doing a .hide()
// because it will invoke any dialog close callbacks.
$('.ui-dialog-titlebar-close:visible').click();
// now initialize your dialog.
var $dialog = $('<div></div>').load($('.ConsultHotels').attr('href')).dialog();
});
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.