Fix tooltip shifting on long descriptions

This puts the tooltip-container under the mouse even on scrollbar
shift due to long descriptions.
This commit is contained in:
Garrett Boone
2021-09-11 14:30:06 -04:00
committed by GitHub
parent d5d655c10a
commit e5d22682cb
2 changed files with 4 additions and 4 deletions

View File

@@ -63,14 +63,14 @@ KB.on('dom.ready', function() {
var elementRect = element.getBoundingClientRect();
var top = elementRect.top + window.scrollY + elementRect.height;
containerElement.style.top = top + "px";
containerElement.style.top = top - 20 + "px";
if (elementRect.left > (window.innerWidth - 600)) {
var right = window.innerWidth - elementRect.right - window.scrollX;
containerElement.style.right = right + "px";
containerElement.style.right = right - 25 + "px";
} else {
var left = elementRect.left + window.scrollX;
containerElement.style.left = left + "px";
containerElement.style.left = left - 25 + "px";
}
document.body.appendChild(containerElement);