From 7d94c0323609581306c3ca7e353cfb6a62a9acc2 Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Mon, 25 Jul 2016 16:00:37 +0200 Subject: [PATCH] Fixed dropdown escaping the document's top --- wcfsetup/install/files/js/WCF.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/wcfsetup/install/files/js/WCF.js b/wcfsetup/install/files/js/WCF.js index e5f0cd8d68..27716dc37a 100755 --- a/wcfsetup/install/files/js/WCF.js +++ b/wcfsetup/install/files/js/WCF.js @@ -1260,7 +1260,12 @@ WCF.Dropdown = { } } else { - if ($top + $menuDimensions.height > $(window).height() + $(document).scrollTop()) { + var menuHeight = $menuDimensions.height; + var scrollTop = $(document).scrollTop(); + + // only open towards the top if there is not enough space downwards + // *and* the dropdown does not overflow the document's top + if (($top + menuHeight > $(window).height() + scrollTop) && ($top + scrollTop) - menuHeight > 0) { $bottom = $(window).height() - $dropdownOffsets.top + 10; $top = 'auto'; -- 2.20.1