Fixes dropdown menu alignment on first call
authorAlexander Ebert <ebert@woltlab.com>
Sat, 14 Sep 2013 20:36:27 +0000 (22:36 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Sat, 14 Sep 2013 20:36:27 +0000 (22:36 +0200)
Fixes #1503

wcfsetup/install/files/js/WCF.js

index 620eaffb5f5fc9dcdcc07e067127e6d34770d1dd..d2e0fcdba58b4fb43bd811d8a278e7faf81dbe91 100755 (executable)
@@ -993,6 +993,13 @@ WCF.Dropdown = {
         * @param       jQuery          dropdownMenu
         */
        setAlignment: function(dropdown, dropdownMenu) {
+               // force dropdown menu to be placed in the upper left corner, otherwise
+               // it might cause the calculations to be a bit off if the page exceeds
+               // the window boundaries during getDimensions() making it visible
+               if (!dropdownMenu.data('isInitialized')) {
+                       dropdownMenu.data('isInitialized', true).css({ left: 0, top: 0 });
+               }
+               
                // get dropdown position
                var $dropdownDimensions = dropdown.getDimensions('outer');
                var $dropdownOffsets = dropdown.getOffsets('offset');