]> source.dussan.org Git - jquery-ui.git/commitdiff
Dialog: When animating dialog close, wait until after the animation completes before...
authorScott González <scott.gonzalez@gmail.com>
Sat, 21 Feb 2009 17:02:52 +0000 (17:02 +0000)
committerScott González <scott.gonzalez@gmail.com>
Sat, 21 Feb 2009 17:02:52 +0000 (17:02 +0000)
ui/ui.dialog.js

index 18f4bb6b7fdb201e48f704a15a631a44e0b45c29..6045fb51f4b8b6d2ce97df817d1f28c3541f142d 100644 (file)
@@ -154,19 +154,24 @@ $.widget("ui.dialog", {
        },
 
        close: function(event) {
-               if (false === this._trigger('beforeclose', event)) {
+               var self = this;
+               
+               if (false === self._trigger('beforeclose', event)) {
                        return;
                }
 
-               (this.overlay && this.overlay.destroy());
-               this.uiDialog
-                       .hide(this.options.hide)
-                       .unbind('keypress.ui-dialog');
+               (self.overlay && self.overlay.destroy());
+               self.uiDialog.unbind('keypress.ui-dialog');
+
+               (self.options.hide
+                       ? self.uiDialog.hide(self.options.hide, function() {
+                               self._trigger('close', event);
+                       })
+                       : self._trigger('close', event));
 
-               this._trigger('close', event);
                $.ui.dialog.overlay.resize();
 
-               this._isOpen = false;
+               self._isOpen = false;
        },
 
        isOpen: function() {