我有一个网页,其中包含一个用iframe渲染的另一页(同一域名)。我需要获取与父文档相关的鼠标位置。请记住,iframe可以双向滚动。我已尝试使用offset,但没有成功。
$('#iframe').contents().find('html').on('mousemove', function (e) {
//gives me location in terms of the iframe but not the entire page.
var y = e.pageY;
//gives me 0
var y = $(this).offset().top;
//more code here....
})
top.window.screenX/Y
和e.screenX/Y
的位置? - Teemutop.window.screenX
在Chrome中不起作用。 - mariob_452