From: Matthias Schmidt Date: Fri, 2 Aug 2013 13:16:47 +0000 (+0200) Subject: Adds further dropdown position checks for overlay dropdowns X-Git-Tag: 2.0.0_Beta_7~62^2~24 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=d3fb02837f698d081208b93d3866b3bb4f5bb17d;p=GitHub%2FWoltLab%2FWCF.git Adds further dropdown position checks for overlay dropdowns --- 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());