From d83677cd4fc15f24f9e83f77c024709ef2c71ebd Mon Sep 17 00:00:00 2001 From: Eli Dupuis Date: Tue, 25 Oct 2011 15:36:53 -0600 Subject: [PATCH] fix bug with escapeClose option --- jquery.modal.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/jquery.modal.js b/jquery.modal.js index 41c9ed9..4459706 100644 --- a/jquery.modal.js +++ b/jquery.modal.js @@ -28,7 +28,7 @@ opacity: options.opacity }); if(options.escapeClose) { - $(document).keydown(function(event) { + $(document).bind('keydown.modal', function(event) { if(event.which == 27) {$.fn.modal.close();} }); } @@ -91,6 +91,8 @@ current_modal.elm.hide(); current_modal.elm.trigger($.fn.modal.CLOSE, [current_modal]); current_modal = null; + + $(document).unbind('keydown.modal'); }; $.fn.modal.resize = function() {