diff --git a/index.html b/index.html index 3cb311e..1602787 100644 --- a/index.html +++ b/index.html @@ -1,7 +1,7 @@ - noob + Zipcode Finder @@ -13,3 +13,4 @@ + diff --git a/script.js b/script.js index 42ea703..606aea0 100644 --- a/script.js +++ b/script.js @@ -1,3 +1,5 @@ +"use strict"; + var mouseX, mouseY; denmark.onmousemove = event => { @@ -8,8 +10,8 @@ denmark.onmousemove = event => { mouseX = event.x - rect.left; mouseY = event.y - rect.top; - var coordX = mouseX * 0.00875 + 6; - var coordY = Math.abs(mouseY * 0.0052 - 58); + var coordX = mouseX / event.target.clientWidth * 8 + 6.2; + var coordY = Math.abs(mouseY / event.target.clientHeight * 3.6 - 57.93); coords.innerHTML = `${coordX}
${coordY}`; @@ -46,3 +48,4 @@ function onZipError() { zip.style.top = (mouseY+3) + "px"; zip.style.display = "block"; } +