Javascript Jquery模式未正确关闭
我的jquery模式有一个问题,它在InternetExplorer中无法正确关闭,但在chrome中运行良好 JS不是我的强项,所以我无法解决它。这里是我用来打开模态和关闭脚本的代码Javascript Jquery模式未正确关闭,javascript,jquery,simplemodal,Javascript,Jquery,Simplemodal,我的jquery模式有一个问题,它在InternetExplorer中无法正确关闭,但在chrome中运行良好 JS不是我的强项,所以我无法解决它。这里是我用来打开模态和关闭脚本的代码 jQuery(function ($) { var login = { message: null, init: function () { $('#login').click(function (e) { e
jQuery(function ($) {
var login = {
message: null,
init: function () {
$('#login').click(function (e) {
e.preventDefault();
// load the contact form using ajax
$.get("../_Includes/login.php", function(data){
// create a modal dialog with the data
$(data).modal({
closeHTML: "<a href='#' title='Close' class='modal-close'>x</a>",
position: ["15%",],
overlayId: 'login-overlay',
containerId: 'login-container',
onOpen: login.open,
onShow: login.show,
onClose: login.close
});
});
});
},
open: function (dialog) {
dialog.overlay.fadeIn(200, function () {
dialog.container.fadeIn(200, function () {
dialog.data.fadeIn(200, function () {
$('#login-container').animate({
height: h
}, function () {
$('#login-container form').fadeIn(200, function () {
});
});
});
});
});
},
show: function (dialog) {
$('#loginForm').on('submit', function (e) {
e.preventDefault();$('input[type=submit]', this).attr('disabled', 'disabled');
var username = $("#username").val();
var password = $("#password").val();
var url = "../_Scripts/login.php";
if (!username) {
$('input[type=submit]', this).removeAttr('disabled');
$("#loginReply").html('<img src="../_Images/round_error.png" alt="Error" width="31" height="30" /> Please enter your Username.').show().fadeOut(6000);
return false;
}
else if (!password) {
$('input[type=submit]', this).removeAttr('disabled');
$("#loginReply").html('<img src="../_Images/round_error.png" alt="Error" width="31" height="30" /> Please enter your Password.').show().fadeOut(6000);
return false;
}
else {
$('input[type=submit]', this).removeAttr('disabled');
$.post(url, $('#loginForm').serialize(), function (data) {
if(data.status == true){
window.location = data.action;
} else{
$("#loginReply").html(data.action).show().fadeOut(10000);
$("#username").val('');
$("#password").val('');
$("#loginProcessGif").hide();
}
});
}
});
},
close: function (dialog) {
dialog.overlay.fadeOut(200, function () {
$.modal.close();
});
},
};
login.init();
});
jQuery(函数($){
var登录={
消息:空,
init:函数(){
$(“#登录”)。单击(函数(e){
e、 预防默认值();
//使用ajax加载联系人表单
$.get(“../\u Includes/login.php”,函数(数据){
//使用数据创建一个模态对话框
$(数据)({
关闭HTML:“”,
职位:[“15%”,],
overlayId:'登录覆盖',
containerId:“登录容器”,
onOpen:login.open,
onShow:login.show,
onClose:login.close
});
});
});
},
打开:函数(对话框){
dialog.overlay.fadeIn(200,函数(){
dialog.container.fadeIn(200,函数(){
dialog.data.fadeIn(200,函数(){
$(“#登录容器”).animate({
身高:h
},函数(){
$(“#登录容器表单”).fadeIn(200,函数(){
});
});
});
});
});
},
显示:函数(对话框){
$('#loginForm')。在('submit',函数(e)上{
e、 preventDefault();$('input[type=submit]',this).attr('disabled','disabled');
var username=$(“#username”).val();
var password=$(“#password”).val();
var url=“../\u Scripts/login.php”;
如果(!用户名){
$('input[type=submit]',this.removeAttr('disabled');
$(“#loginReply”).html('请输入您的用户名').show().fadeOut(6000);
返回false;
}
否则如果(!密码){
$('input[type=submit]',this.removeAttr('disabled');
$(“#loginReply”).html('请输入密码').show().fadeOut(6000);
返回false;
}
否则{
$('input[type=submit]',this.removeAttr('disabled');
$.post(url,$('#loginForm').serialize(),函数(数据){
如果(data.status==true){
window.location=data.action;
}否则{
$(“#loginReply”).html(data.action.show().fadeOut(10000);
$(“#用户名”).val(“”);
$(“#密码”).val(“”);
$(“#loginprocessgf”).hide();
}
});
}
});
},
关闭:函数(对话框){
dialog.overlay.fadeOut(200,函数(){
$.modal.close();
});
},
};
login.init();
});
有人能解释一下吗
谢谢您的错误是什么?清楚地更新您的需求我没有收到错误,它只是不会关闭没有错误,那么问题是什么。请在fiddle中更新,控制台中无任何内容。也似乎无法让小提琴工作