#My code is not detecting mouse click after certain x coordinate while zoomed in (HTML and JS)

1 messages · Page 1 of 1 (latest)

gaunt isle
#

My code is not detecting key presses after a certain x coordinate while zoomed in.

<div id="map-container">
    <img id="map" src="images/map.png">
</div>
let mapc = document.getElementById("map-container");

mapc.addEventListener("click", function(event) {
    let guess = document.getElementById("guess");

    guess.style.visibility = "visible";
    guess.style.top = event.pageY + 'px';
    guess.style.left = event.pageX + 'px';
    console.log("click: " + event.pageX + ", " + event.pageY);
});
gaunt isle
#

[SOLVED]

hazy comet
#

Additionally, it may be helpful to others if you explain your solution. That way other people who may search for similar issues can read how to work around or fix it.
You don't have to of course. But it is courteous