From c8ee6af8576a5139d1171f3c7cb9321a173a2c19 Mon Sep 17 00:00:00 2001 From: max-m Date: Tue, 9 Apr 2013 20:08:59 +0200 Subject: [PATCH] Fixes balloon tooltips Balloon tooltips will show up above the hovered element if necessary --- wcfsetup/install/files/js/WCF.js | 11 ++++++++++- wcfsetup/install/files/style/global.less | 11 +++++++++-- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/wcfsetup/install/files/js/WCF.js b/wcfsetup/install/files/js/WCF.js index 9c38fbbbb0..bdb635fff0 100755 --- a/wcfsetup/install/files/js/WCF.js +++ b/wcfsetup/install/files/js/WCF.js @@ -4230,7 +4230,16 @@ WCF.Effect.BalloonTooltip = Class.extend({ } // calculate top offset - var $top = $elementOffsets.top + $elementDimensions.height + 7; + if ($elementOffsets.top + $elementDimensions.height + $tooltipDimensions.height - $(document).scrollTop() < $(window).height()) { + var $top = $elementOffsets.top + $elementDimensions.height + 7; + this._tooltip.removeClass('inverse'); + $arrow.css('top', -5); + } + else { + var $top = $elementOffsets.top - $elementDimensions.height - 7; + this._tooltip.addClass('inverse'); + $arrow.css('top', $tooltipDimensions.height); + } // calculate left offset switch ($alignment) { diff --git a/wcfsetup/install/files/style/global.less b/wcfsetup/install/files/style/global.less index 07c02cae8a..1e1166fba2 100644 --- a/wcfsetup/install/files/style/global.less +++ b/wcfsetup/install/files/style/global.less @@ -164,8 +164,6 @@ body > iframe[src="about:blank"] { z-index: 800; .borderRadius(6px); - .boxShadow(0, 3px, rgba(0, 0, 0, .3), 7px); - .pointer { border-color: @wcfTooltipBackgroundColor transparent; border-style: solid; @@ -174,6 +172,15 @@ body > iframe[src="about:blank"] { position: absolute; top: -5px; } + + .boxShadow(0, 3px, rgba(0, 0, 0, .3), 7px); + + &.inverse { + .boxShadow(0, -3px, rgba(0, 0, 0, .3), 7px); + .pointer { + border-width: 5px 5px 0; + } + } } /* popover */ -- 2.20.1