From abe2607ed1273e9402f297fb9dabd9784b65491d Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Fri, 25 Nov 2011 15:43:09 +0100 Subject: [PATCH] Maximum height is now properly calculated --- wcfsetup/install/files/js/WCF.js | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/wcfsetup/install/files/js/WCF.js b/wcfsetup/install/files/js/WCF.js index 6c771c5146..1b77120545 100644 --- a/wcfsetup/install/files/js/WCF.js +++ b/wcfsetup/install/files/js/WCF.js @@ -3397,12 +3397,27 @@ $.widget('ui.wcfDialog', { // temporarily display container this._container.show(); } + + // force content to be visible + this._content.children().each(function() { + $(this).show(); + }); // calculate dimensions var $windowDimensions = $(window).getDimensions(); var $containerDimensions = this._container.getDimensions('outer'); var $contentDimensions = this._content.getDimensions('outer'); + // calculate maximum content height + var $heightDifference = $containerDimensions.height - $contentDimensions.height; + var $maximumHeight = $windowDimensions.height - $heightDifference - 60; + this._content.css({ maxHeight: $maximumHeight + 'px' }); + + // re-caculate values if container height was previously limited + if ($maximumHeight < $contentDimensions.height) { + $containerDimensions = this._container.getDimensions('outer'); + } + // move container var $leftOffset = Math.round(($windowDimensions.width - $containerDimensions.width) / 2); var $topOffset = Math.round(($windowDimensions.height - $containerDimensions.height) / 2); @@ -3413,11 +3428,6 @@ $.widget('ui.wcfDialog', { $topOffset = $desiredTopOffset; } - // calculate maximum content height - var $heightDifference = $containerDimensions.height - $contentDimensions.height; - var $maximumHeight = $windowDimensions.height - $heightDifference - 60; - this._content.css({ maxHeight: $maximumHeight + 'px' }); - if (!this.isOpen()) { // hide container again this._container.hide(); -- 2.20.1