One way to do this is to get the position of the iframe in the parent window and add it to the position of the mouse relative to the iframe itself. Extending your code below
var iframepos = $("#iframe").position();
$('#iframe').contents().find('html').on('mousemove', function (e) {
var x = e.clientX + iframepos.left;
var y = e.clientY + iframepos.top;
console.log(x + " " + y);
})
source
share