我有以下代码
用于花式箱码和登录
$("a#loginID").fancybox({
'onClosed' : function() {
$("#login_error").empty();$("#login_error").hide();
}
});
// for controlling tab
// When a link is clicked
$("a.tab").click(function () {
// switch all tabs off
$(".active").removeClass("active");
// switch this tab on
$(this).addClass("active");
// slide all content up
$(".content").slideUp();
// slide this content up
var content_show = $(this).attr("title");
$("#"+content_show).slideDown();
});
$('.default-value').each(function() {
var default_value = this.value;
$(this).focus(function() {
if(this.value == default_value) {
this.value = '';
$(this).removeClass("onblur").addClass("onfocus");
}
});
$(this).blur(function() {
if(this.value == '') {
this.value = default_value;
$(this).removeClass("onfocus").addClass("onblur");
}
});
});
html
<div style="display:none;">
<div id="popUpLogin" style="width:400px;overflow:auto;">
<div id="tabbed_box_1" class="tabbed_box">
<h4> Wears It Best <small>Select a Tab to login or register</small></h4>
<div class="tabbed_area">
<ul class="tabs">
<li><a href="#" title="content_1" class="tab active">Register</a></li>
<li><a href="#" title="content_2" class="tab">Sign In</a></li>
</ul>
<div id="content_1" class="content">
<form id="form1" name="form1" method="post" action=""><table width="368" border="0" cellspacing="2" cellpadding="2">
<tr>
<td width="368"><strong>Name</strong></td>
</tr>
<tr>
<td><input id="registration-title" name="title" title="Title" class="default-value onblur" maxlength="30" type="text" value="Title"/></td>
</tr>
<tr>
<td>
<input id="registration-firstName" name="firstName" title="First name" class="default-value onblur" maxlength="100" type="text" value="First name" />
<input id="registration-lastName" name="lastName" title="Last name" class="default-value onblur" maxlength="100" type="text" value="Last name"/></td>
</tr>
<tr>
<td><strong>Email</strong></td>
</tr>
<tr>
<td><input id="registration-email" name="registration-email" value="" maxlength="200" type="text" /></td>
</tr>
<tr>
<td><strong>Password</strong> (at least 6 characters)</td>
</tr>
<tr>
<td><input id="registration-password1" name="password1" value="" maxlength="50" type="password" /></td>
</tr>
<tr>
<td><strong>Password</strong> <strong>Confirmation</strong></td>
</tr>
<tr>
<td><input id="registration-password2" name="password2" value="" maxlength="50" type="password" /></td>
</tr>
<tr>
<td><label id="label-consentforcontact" for="consentForContact">
<input type="checkbox" name="contactme" id="contactme" />
Wears It Best can contact me with relevant updates, offers and news</label></td>
</tr>
<tr>
<td>By clicking Create Account you confirm that you agree to our website <a target="_blank" onclick="" href="#">terms of use</a>and our <a target="_blank" onclick="" href="#">privacy policy</a>.</td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td><input id="create-account-button" name="register" value="Create Account" type="submit" /></td>
</tr>
</table>
</form>
</div>
<div id="content_2" class="content">
<form id="loginform" name="loginform" method="post" action=""><table width="368" border="0" cellspacing="2" cellpadding="2">
<tr>
<td colspan="2"><div id="login_error" style="display:none;"> Please enter email or password!!!</div><strong>Email</strong><input name="signin" type="hidden" id="signin" value="signin" /></td>
</tr>
<tr>
<td colspan="2"><input type="text" name="email" id="email" /></td>
</tr>
<tr>
<td><strong>Password</strong></td>
<td> </td>
</tr>
<tr>
<td colspan="2"><input type="password" name="pword" id="pword" /></td>
</tr>
<tr>
<td colspan="2"><input type="submit" id="login" name="login" value="Sign In" /></td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
</table>
</form>
</div>
</div>
</div>
</div>
</div>
它工作正常通常首先打开注册选项卡并且用户尝试登录并失败...它会显示所需的消息...但是如果用户关闭了fancybox并再次打开...选项卡是仍然设置为登录选项卡,并将fancybox调整到中间,这样如果用户点击注册,则选项卡fancybox窗口不会向上调整以容纳注册表单....我该怎么做才能解决这个问题?