diff --git a/gorge.js b/gorge.js index 10e3969..9a2ec22 100644 --- a/gorge.js +++ b/gorge.js @@ -651,7 +651,15 @@ function buildingTooltip(id, event) { let yOffset = tooltip.parentElement.getBoundingClientRect().y; let xPos = tooltip.parentElement.getBoundingClientRect().x - 450; - let yPos = event.clientY; + + // wow browsers are bad + + var body = document.body, + html = document.documentElement; + + var height = Math.max( body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight ); + + let yPos = Math.min(event.clientY, height - 200); tooltip.style.setProperty("transform", "translate(" + xPos + "px, " + yPos + "px)") }