Created
November 1, 2013 12:17
-
-
Save jurchiks/7264596 to your computer and use it in GitHub Desktop.
jQuery UI modal dialog close on overlay click option.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/ui/jquery.ui.dialog.js b/ui/jquery.ui.dialog.js | |
index c5bd42a..9512c10 100644 | |
--- a/ui/jquery.ui.dialog.js | |
+++ b/ui/jquery.ui.dialog.js | |
@@ -26,6 +26,7 @@ $.widget( "ui.dialog", { | |
autoOpen: true, | |
buttons: [], | |
closeOnEscape: true, | |
+ closeOnOverlayClick: false, | |
closeText: "Close", | |
dialogClass: "", | |
draggable: true, | |
@@ -778,9 +779,15 @@ $.widget( "ui.dialog", { | |
this.overlay = $("<div>") | |
.addClass("ui-widget-overlay ui-front") | |
.appendTo( this._appendTo() ); | |
- this._on( this.overlay, { | |
+ var events = { | |
mousedown: "_keepFocus" | |
- }); | |
+ }; | |
+ | |
+ if ( this.options.closeOnOverlayClick ) { | |
+ events.click = "close"; | |
+ } | |
+ | |
+ this._on( this.overlay, events ); | |
this.document.data( "ui-dialog-overlays", | |
(this.document.data( "ui-dialog-overlays" ) || 0) + 1 ); | |
}, |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment