aboutsummaryrefslogtreecommitdiffstats
path: root/ui/ui.dialog.js
diff options
context:
space:
mode:
authorRichard Worth <rdworth@gmail.com>2008-06-25 10:01:24 +0000
committerRichard Worth <rdworth@gmail.com>2008-06-25 10:01:24 +0000
commitd0c11e932bec29bc271acf86db062e3a4d8d3797 (patch)
treeea99a58516289b265e57a0f1d21755e4d7645dea /ui/ui.dialog.js
parentb07cac10cdfdbc2da0da08b7c3906925642bd8ec (diff)
downloadjquery-ui-d0c11e932bec29bc271acf86db062e3a4d8d3797.tar.gz
jquery-ui-d0c11e932bec29bc271acf86db062e3a4d8d3797.zip
fixed #3025 - dialog should have an autoResize option; default value: true
Diffstat (limited to 'ui/ui.dialog.js')
-rw-r--r--ui/ui.dialog.js18
1 files changed, 16 insertions, 2 deletions
diff --git a/ui/ui.dialog.js b/ui/ui.dialog.js
index 4e29f47f2..d6a7fb220 100644
--- a/ui/ui.dialog.js
+++ b/ui/ui.dialog.js
@@ -40,9 +40,9 @@ $.widget("ui.dialog", {
.wrap('<div/>')
.wrap('<div/>'),
- uiDialogContainer = uiDialogContent.parent()
+ uiDialogContainer = (this.uiDialogContainer = uiDialogContent.parent()
.addClass('ui-dialog-container')
- .css({position: 'relative'}),
+ .css({position: 'relative', width: '100%', height: '100%'})),
title = options.title || uiDialogContent.attr('title') || '',
uiDialogTitlebar = (this.uiDialogTitlebar =
@@ -139,10 +139,12 @@ $.widget("ui.dialog", {
(options.resizeStart && options.resizeStart.apply(self.element[0], arguments));
},
resize: function(e, ui) {
+ (options.autoResize && self.size.apply(self));
(options.resize && options.resize.apply(self.element[0], arguments));
},
handles: resizeHandles,
stop: function(e, ui) {
+ (options.autoResize && self.size.apply(self));
(options.resizeStop && options.resizeStop.apply(self.element[0], arguments));
$.ui.dialog.overlay.resize();
}
@@ -231,12 +233,23 @@ $.widget("ui.dialog", {
pTop = Math.max(pTop, minTop);
this.uiDialog.css({top: pTop, left: pLeft});
},
+
+ size: function() {
+ var container = this.uiDialogContainer,
+ titlebar = this.uiDialogTitlebar,
+ content = this.element,
+ tbMargin = parseInt(content.css('margin-top')) + parseInt(content.css('margin-bottom')),
+ lrMargin = parseInt(content.css('margin-left')) + parseInt(content.css('margin-right'));
+ content.height(container.height() - titlebar.outerHeight() - tbMargin);
+ content.width(container.width() - lrMargin);
+ },
open: function() {
this.overlay = this.options.modal ? new $.ui.dialog.overlay(this) : null;
this.uiDialog.appendTo('body');
this.position(this.options.position);
this.uiDialog.show(this.options.show);
+ this.options.autoResize && this.size();
this.moveToTop(true);
// CALLBACK: open
@@ -289,6 +302,7 @@ $.widget("ui.dialog", {
$.extend($.ui.dialog, {
defaults: {
autoOpen: true,
+ autoResize: true,
bgiframe: false,
buttons: {},
closeOnEscape: true,