您好我已经为wordpress创建了3个用于登录注册和密码重置的模式,但我对幻灯片菜单z-index有问题,所以当我点击模态时找到一种方法来添加类到body标签会很棒按钮。
这是我的javascript代码:
jQuery(document).ready(function(a) {
a("#pop_login, #pop_signup").on("click", function(b) {
return formToFadeOut = a("#register"), formtoFadeIn = a("#login"), "pop_signup" == a(this).attr("id") && (formToFadeOut = a("#login"), formtoFadeIn = a("#register")), formToFadeOut.fadeOut(10, function() {
formtoFadeIn.fadeIn()
}), !1
}), a("#pop_forgot").click(function() {
return formToFadeOut = a("#login"), formtoFadeIn = a("#forgot_password"), formToFadeOut.fadeOut(10, function() {
formtoFadeIn.fadeIn()
}), !1
}), a(document).on("click", ".modal-backdrop, span.close", function() {
return a("#login, #register, #forgot_password").fadeOut(10, function() {
a(".login_overlay").remove()
}), !1
}), a("#show_login, #show_signup").on("click", function(b) {
a("body").prepend('<div class="modal-backdrop fade in" style="height: 541px;"></div>'), "show_login" == a(this).attr("id") ? a("#login").fadeIn(10) : a("#register").fadeIn(10), b.preventDefault()
}), a("#login_form, #registration_form").on("submit", function(b) {
return !!a(this).valid() && (a("p.errors", this).show().text(ajax_auth_object.loadingmessage), action = "ajaxlogin", username = a("#login_form #username").val(), password = a("#login_form #password").val(), email = "", security = a("#login_form #security").val(), "registration_form" == a(this).attr("id") && (action = "ajaxregister", username = a("#signonname").val(), password = a("#signonpassword").val(), email = a("#email").val(), security = a("#signonsecurity").val()), ctrl = a(this), a.ajax({
type: "POST",
dataType: "json",
url: ajax_auth_object.ajaxurl,
data: {
action: action,
username: username,
password: password,
email: email,
security: security
},
success: function(b) {
a("p.errors", ctrl).text(b.message), 1 == b.loggedin && (document.location.href = ajax_auth_object.redirecturl)
}
}), void b.preventDefault())
}), a("#forgot_pass").on("submit", function(b) {
return !!a(this).valid() && (a("p.errors", this).show().text(ajax_auth_object.loadingmessage), ctrl = a(this), a.ajax({
type: "POST",
dataType: "json",
url: ajax_auth_object.ajaxurl,
data: {
action: "ajaxforgotpassword",
user_login: a("#user_login").val(),
security: a("#forgotsecurity").val()
},
success: function(b) {
a("p.errors", ctrl).text(b.message)
}
}), b.preventDefault(), !1)
}), a("#register").length ? a("#register").validate({
rules: {
password2: {
equalTo: "#signonpassword"
}
}
}) : a("#login").length && a("#login").validate(), a("#forgot_pass").length && a("#forgot_pass").validate()
});
答案 0 :(得分:1)
如果我理解正确,你可以使用jQuery表示法:for i, line in enumerate(wordListFile):
if(i == currentLine):
line = line
passwordChecking = line
#rest of the code.
。
答案 1 :(得分:0)
谢谢你们,我在两个不同的行上添加了.addClass(“burimi”)和.removeClass(“burimi”),完整的代码在下面感谢所有的帮助和回复:
jQuery(document).ready(function(a) {
a("#pop_login, #pop_signup").on("click", function(b) {
jQuery('body').addClass('burimi');
return formToFadeOut = a("#register"), formtoFadeIn = a("#login"), "pop_signup" == a(this).attr("id") && (formToFadeOut = a("#login"), formtoFadeIn = a("#register")), formToFadeOut.fadeOut(10, function() {
formtoFadeIn.fadeIn()
}), !1
}), a("#pop_forgot").click(function() {
return formToFadeOut = a("#login"), formtoFadeIn = a("#forgot_password"), formToFadeOut.fadeOut(10, function() {
formtoFadeIn.fadeIn()
}), !1
}), a(document).on("click", ".modal-backdrop, span.close", function() {
return a("#login, #register, #forgot_password").fadeOut(10, function() {
a(".login_overlay").remove()
a("body").removeClass("burimi")
}), !1
}), a("#show_login, #show_signup").on("click", function(b) {
a("body").addClass("burimi").prepend('<div class="modal-backdrop fade in" style="height: 541px;"></div>'), "show_login" == a(this).attr("id") ? a("#login").fadeIn(10) : a("#register").fadeIn(10), b.preventDefault()
}), a("#login_form, #registration_form").on("submit", function(b) {
return !!a(this).valid() && (a("p.errors", this).show().text(ajax_auth_object.loadingmessage), action = "ajaxlogin", username = a("#login_form #username").val(), password = a("#login_form #password").val(), email = "", security = a("#login_form #security").val(), "registration_form" == a(this).attr("id") && (action = "ajaxregister", username = a("#signonname").val(), password = a("#signonpassword").val(), email = a("#email").val(), security = a("#signonsecurity").val()), ctrl = a(this), a.ajax({
type: "POST",
dataType: "json",
url: ajax_auth_object.ajaxurl,
data: {
action: action,
username: username,
password: password,
email: email,
security: security
},
success: function(b) {
a("p.errors", ctrl).text(b.message), 1 == b.loggedin && (document.location.href = ajax_auth_object.redirecturl)
}
}), void b.preventDefault())
}), a("#forgot_pass").on("submit", function(b) {
return !!a(this).valid() && (a("p.errors", this).show().text(ajax_auth_object.loadingmessage), ctrl = a(this), a.ajax({
type: "POST",
dataType: "json",
url: ajax_auth_object.ajaxurl,
data: {
action: "ajaxforgotpassword",
user_login: a("#user_login").val(),
security: a("#forgotsecurity").val()
},
success: function(b) {
a("p.errors", ctrl).text(b.message)
}
}), b.preventDefault(), !1)
}), a("#register").length ? a("#register").validate({
rules: {
password2: {
equalTo: "#signonpassword"
}
}
}) : a("#login").length && a("#login").validate(), a("#forgot_pass").length && a("#forgot_pass").validate()
});