From d3fb02837f698d081208b93d3866b3bb4f5bb17d Mon Sep 17 00:00:00 2001 From: Matthias Schmidt Date: Fri, 2 Aug 2013 15:16:47 +0200 Subject: [PATCH] Adds further dropdown position checks for overlay dropdowns --- wcfsetup/install/files/js/WCF.js | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/wcfsetup/install/files/js/WCF.js b/wcfsetup/install/files/js/WCF.js index b91a5d3e81..98a6982e16 100755 --- a/wcfsetup/install/files/js/WCF.js +++ b/wcfsetup/install/files/js/WCF.js @@ -749,14 +749,28 @@ WCF.Dropdown = { var $dialogContent = $(event.currentTarget); $dialogContent.find('.dropdown.dropdownOpen').each(function(index, element) { var $dropdown = $(element); - var $scrollTolerance = $(element).height() / 2; + var $dropdownID = $dropdown.wcfIdentify(); + var $dropdownOffset = $dropdown.offset(); + var $dialogContentOffset = $dialogContent.offset(); + + var $verticalScrollTolerance = $(element).height() / 2; // check if dropdown toggle is still (partially) visible - if ($dropdown.offset().top + $scrollTolerance <= $dialogContent.offset().top) { // top check - WCF.Dropdown.toggleDropdown($dropdown.wcfIdentify()); + if ($dropdownOffset.top + $verticalScrollTolerance <= $dialogContentOffset.top) { + // top check + WCF.Dropdown.toggleDropdown($dropdownID); + } + else if ($dropdownOffset.top >= $dialogContentOffset.top + $dialogContent.height()) { + // bottom check + WCF.Dropdown.toggleDropdown($dropdownID); + } + else if ($dropdownOffset.left <= $dialogContentOffset.left) { + // left check + WCF.Dropdown.toggleDropdown($dropdownID); } - else if ($dropdown.offset().top >= $dialogContent.offset().top + $dialogContent.height()) { // bottom check - WCF.Dropdown.toggleDropdown($dropdown.wcfIdentify()); + else if ($dropdownOffset.left >= $dialogContentOffset.left + $dialogContent.width()) { + // right check + WCF.Dropdown.toggleDropdown($dropdownID); } else { WCF.Dropdown.setAlignmentByID($dropdown.wcfIdentify()); -- 2.20.1