From 4b576545923ae9269f9a477f59840c5334ba8dad Mon Sep 17 00:00:00 2001 From: TwinProduction Date: Tue, 25 Aug 2020 14:27:13 -0400 Subject: [PATCH] Fix issue with tooltip overflowing at the top --- static/index.html | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/static/index.html b/static/index.html index 00ed3aa6..91d16882 100644 --- a/static/index.html +++ b/static/index.html @@ -157,8 +157,11 @@ targetLeftPosition += -targetLeftPosition; } } - if (targetTopPosition + window.scrollY + tooltipBoundingClientRect.height + 50 > document.body.getBoundingClientRect().height) { - targetTopPosition = element.getBoundingClientRect().y - (tooltipBoundingClientRect.height + 10) + if (targetTopPosition + window.scrollY + tooltipBoundingClientRect.height + 50 > document.body.getBoundingClientRect().height && targetTopPosition >= 0) { + targetTopPosition = element.getBoundingClientRect().y - (tooltipBoundingClientRect.height + 10); + if (targetTopPosition < 0) { + targetTopPosition = element.getBoundingClientRect().y + 30; + } } $("#tooltip").css({top: targetTopPosition + "px", left: targetLeftPosition + "px"}); }