Maximum height is now properly calculated
authorAlexander Ebert <ebert@woltlab.com>
Fri, 25 Nov 2011 14:43:09 +0000 (15:43 +0100)
committerAlexander Ebert <ebert@woltlab.com>
Fri, 25 Nov 2011 14:43:09 +0000 (15:43 +0100)
wcfsetup/install/files/js/WCF.js

index 6c771c514665a8b4b9fe254c47568517a392a96b..1b77120545c701976142bf044805edef6331b9ec 100644 (file)
@@ -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();