diff --git a/jquery.modal.js b/jquery.modal.js index 9b98356..c4ede0b 100644 --- a/jquery.modal.js +++ b/jquery.modal.js @@ -37,6 +37,7 @@ el.trigger($.modal.AJAX_FAIL); current.hideSpinner(); el.trigger($.modal.AJAX_COMPLETE); + current = null; }); } } else { @@ -50,7 +51,7 @@ open: function() { var m = this; - if(this.options.doFade) { + if (this.options.doFade) { this.block(); setTimeout(function() { m.show(); @@ -85,14 +86,14 @@ opacity: initialOpacity }); this.$body.append(this.blocker); - if(this.options.doFade) { + if (this.options.doFade) { this.blocker.animate({opacity: this.options.opacity}, this.options.fadeDuration); } this.$elm.trigger($.modal.BLOCK, [this._ctx()]); }, unblock: function() { - if(this.options.doFade) { + if (this.options.doFade) { this.blocker.fadeOut(this.options.fadeDuration, function() { this.remove(); }); @@ -109,7 +110,7 @@ } this.$elm.addClass(this.options.modalClass + ' current'); this.center(); - if(this.options.doFade) { + if (this.options.doFade) { this.$elm.fadeIn(this.options.fadeDuration); } else { this.$elm.show(); @@ -122,7 +123,7 @@ if (this.closeButton) this.closeButton.remove(); this.$elm.removeClass('current'); - if(this.options.doFade) { + if (this.options.doFade) { this.$elm.fadeOut(this.options.fadeDuration); } else { this.$elm.hide(); @@ -175,11 +176,11 @@ if (!current) return; current.resize(); }; - + // Returns if there currently is an active modal $.modal.isActive = function () { return current ? true : false; - } + } $.modal.defaults = { overlay: "#000",