mirror of
https://github.com/jquery/jquery-ui.git
synced 2024-10-05 01:44:18 +00:00
Dialog: Shadow cleanup.
- Don't hide shadow during drag/resize in IE6 (let the user do this one their own). - Let users modify the shadow option after init. .parents('.ui-dialog') .bind('dragstart resizestart', function() { $(this).find('.ui-dialog-content').dialog('option', 'shadow', false); }) .bind('dragstop resizestop', function() { $(this).find('.ui-dialog-content').dialog('option', 'shadow', true); });
This commit is contained in:
parent
6695e5ac7f
commit
171c7c0671
@ -244,8 +244,7 @@ $.widget("ui.dialog", {
|
|||||||
.filter(':first')
|
.filter(':first')
|
||||||
.focus();
|
.focus();
|
||||||
|
|
||||||
if(options.shadow)
|
(options.shadow && this._createShadow());
|
||||||
this._createShadow();
|
|
||||||
|
|
||||||
this._trigger('open', event);
|
this._trigger('open', event);
|
||||||
this._isOpen = true;
|
this._isOpen = true;
|
||||||
@ -306,16 +305,14 @@ $.widget("ui.dialog", {
|
|||||||
containment: 'document',
|
containment: 'document',
|
||||||
start: function() {
|
start: function() {
|
||||||
(options.dragStart && options.dragStart.apply(self.element[0], arguments));
|
(options.dragStart && options.dragStart.apply(self.element[0], arguments));
|
||||||
if($.browser.msie && $.browser.version < 7 && self.shadow) self.shadow.hide();
|
|
||||||
},
|
},
|
||||||
drag: function() {
|
drag: function() {
|
||||||
(options.drag && options.drag.apply(self.element[0], arguments));
|
(options.drag && options.drag.apply(self.element[0], arguments));
|
||||||
self._refreshShadow(1);
|
self._refreshShadow();
|
||||||
},
|
},
|
||||||
stop: function() {
|
stop: function() {
|
||||||
(options.dragStop && options.dragStop.apply(self.element[0], arguments));
|
(options.dragStop && options.dragStop.apply(self.element[0], arguments));
|
||||||
$.ui.dialog.overlay.resize();
|
$.ui.dialog.overlay.resize();
|
||||||
if($.browser.msie && $.browser.version < 7 && self.shadow) self.shadow.show();
|
|
||||||
self._refreshShadow();
|
self._refreshShadow();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -339,17 +336,15 @@ $.widget("ui.dialog", {
|
|||||||
minHeight: options.minHeight,
|
minHeight: options.minHeight,
|
||||||
start: function() {
|
start: function() {
|
||||||
(options.resizeStart && options.resizeStart.apply(self.element[0], arguments));
|
(options.resizeStart && options.resizeStart.apply(self.element[0], arguments));
|
||||||
if($.browser.msie && $.browser.version < 7 && self.shadow) self.shadow.hide();
|
|
||||||
},
|
},
|
||||||
resize: function() {
|
resize: function() {
|
||||||
(options.resize && options.resize.apply(self.element[0], arguments));
|
(options.resize && options.resize.apply(self.element[0], arguments));
|
||||||
self._refreshShadow(1);
|
self._refreshShadow();
|
||||||
},
|
},
|
||||||
handles: resizeHandles,
|
handles: resizeHandles,
|
||||||
stop: function() {
|
stop: function() {
|
||||||
(options.resizeStop && options.resizeStop.apply(self.element[0], arguments));
|
(options.resizeStop && options.resizeStop.apply(self.element[0], arguments));
|
||||||
$.ui.dialog.overlay.resize();
|
$.ui.dialog.overlay.resize();
|
||||||
if($.browser.msie && $.browser.version < 7 && self.shadow) self.shadow.show();
|
|
||||||
self._refreshShadow();
|
self._refreshShadow();
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@ -440,7 +435,11 @@ $.widget("ui.dialog", {
|
|||||||
|
|
||||||
// currently non-resizable, becoming resizable
|
// currently non-resizable, becoming resizable
|
||||||
(isResizable || this._makeResizable(value));
|
(isResizable || this._makeResizable(value));
|
||||||
|
break;
|
||||||
|
case "shadow":
|
||||||
|
(value
|
||||||
|
? this.shadow || this._createShadow()
|
||||||
|
: this.shadow && this._destroyShadow());
|
||||||
break;
|
break;
|
||||||
case "title":
|
case "title":
|
||||||
$(".ui-dialog-title", this.uiDialogTitlebar).html(value || ' ');
|
$(".ui-dialog-title", this.uiDialogTitlebar).html(value || ' ');
|
||||||
@ -489,17 +488,16 @@ $.widget("ui.dialog", {
|
|||||||
return this.shadow;
|
return this.shadow;
|
||||||
},
|
},
|
||||||
|
|
||||||
_refreshShadow: function(dragging) {
|
_refreshShadow: function() {
|
||||||
// IE6 is simply to slow to handle the reflow in a good way, so
|
if (!this.options.shadow) { return; }
|
||||||
// resizing only happens on stop, and the shadow is hidden during drag/resize
|
|
||||||
if(dragging && $.browser.msie && $.browser.version < 7) return;
|
|
||||||
|
|
||||||
var offset = this.uiDialog.offset();
|
var uiDialog = this.uiDialog,
|
||||||
|
offset = uiDialog.offset();
|
||||||
this.shadow.css({
|
this.shadow.css({
|
||||||
left: offset.left,
|
left: offset.left,
|
||||||
top: offset.top,
|
top: offset.top,
|
||||||
width: this.uiDialog.outerWidth(),
|
width: uiDialog.outerWidth(),
|
||||||
height: this.uiDialog.outerHeight()
|
height: uiDialog.outerHeight()
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -507,7 +505,6 @@ $.widget("ui.dialog", {
|
|||||||
this.shadow.remove();
|
this.shadow.remove();
|
||||||
this.shadow = null;
|
this.shadow = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
$.extend($.ui.dialog, {
|
$.extend($.ui.dialog, {
|
||||||
|
Loading…
Reference in New Issue
Block a user