This solves the problem:
// Mouse coordinates for event.clientX, event.clientY respectively. var myClientX, myClientY; // This call makes sure that global variables myClientX, myClientY are up to date window.document.addEventListener("mousemove", function(event) { myClientX = event.clientX; myClientY = event.clientY; }, false);
Creating global coordinates allows me to access them whenever I want :)
source share