Jquery Modal未正确关闭

时间:2014-01-07 10:51:06

标签: javascript jquery simplemodal

我的jquery模式有问题,它在Internet Explorer中没有正确关闭,但在chrome中运行正常。

JS不是我强大的主题,所以无法解决问题。这里是用于打开模态和关闭脚本的代码

    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" /> &nbsp; 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" /> &nbsp; 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();
});

任何人都可以对此有所了解吗?

由于

0 个答案:

没有答案
相关问题