我在页面中有3个Jquery弹出窗口。当我打开一个窗口说登录弹出窗口,然后我打开另一个说反馈弹出窗口,我需要让我的登录弹出窗口关闭,当我点击反馈弹出链接。 以下是我登录弹出窗口的示例代码。我也使用相同的反馈弹出窗口。请帮助我查询。 谢谢大家提前。如何在另一个弹出窗口打开时自动关闭JQuery中的弹出窗口?
$(document).ready(function() {
$('a.login-window').click(function() {
//Getting the variable's value from a link
var loginBox = $(this).attr('href');
//Fade in the Popup
$(loginBox).fadeIn(300);
//Set the center alignment padding + border see css style
var popMargTop = ($(loginBox).height() + 24)/2;
var popMargLeft = ($(loginBox).width() + 24)/2;
$(loginBox).css({
'margin-top' : -popMargTop,
'margin-left' : -popMargLeft
});
// Add the mask to body
$('body').append('<div id="mask"></div>');
$('#mask').fadeIn(300);
return false;
});
// When clicking on the button close or the mask layer the popup closed
$('a.close, #mask').live('click', function() {
$('#mask , .login-popup').fadeOut(300 , function() {
$('#mask').remove();
});
return false;
});
你试试这个http://stackoverflow.com/questions/5274109/javascript-close-popup-open-new-window-redirect – btevfik 2013-03-25 05:07:22
向我们提供您的http://jsfiddle.net/(使用HTML,CSS,jQuery和其他库),以便我们更轻松地查看代码和帮助。 – kyooriouskoala 2013-03-25 07:26:52
@btevfik我想在jQuery中的代码,以便我可以用动画写入它,以弹出我的弹出窗口。 – vickythegme 2013-03-27 03:03:54