我已经创建了2弹出对话框,当你点击一个链接。
我想要做的是:
如果我打开一个弹出式窗口并试图打开另一个弹出式窗口,那么打开的弹出式框会消失,而且当我打开这两个弹出式窗口并单击关闭按钮时,它们也会关闭,就像再次单击链接一样-我如何将其分开??
下面是示例:http://jsfiddle.net/zidski/ZBfTy/
发布于 2011-08-26 22:00:52
如果你想让它们互斥,你可以在打开一个盒子之前运行close_modal();。
http://jsfiddle.net/Znarkus/ZBfTy/4/
发布于 2011-08-26 22:03:21
如果你打开了其中的两个来关闭其中的一个,你需要像这样修改你的代码:
$('.close_modal').click(function(){
//use the function to close it
close_modal(this); // Passing the clicked link to the function
});
});
//THE FUNCTIONS
function close_modal(link){
//hide the mask
$('#mask').fadeOut(500);
//hide modal window(s)
// using the clicked link to get the parent to close.
$(link).parent().fadeOut(500);
}发布于 2011-08-26 22:03:58
你在close函数中遇到问题。这里是更改的一个。
close_modal(this);
function close_modal(t){
//hide the mask
$("#mask").fadeOut(500);
//hide modal window(s)
$(t).parent().parent().children('.modal_window').fadeOut(500);
}https://stackoverflow.com/questions/7205711
复制相似问题