How to get absolute coordinates of document with JS?

html, javascript, jquery

Solution

You can do this (taking some assumptions):

//this is the border width of the OS window.
var border= (window.outerWidth-window.innerWidth)/2; 

//Assuming the window border is homogeneous and there is nothing in
// the bottom of the window (firebug or something like that)
var menuHeight=(window.outerHeight-window.innerHeight)-border*2;

var absX=window.screenX + border;
var absY=window.screenY+border+menuHeight;

Problem

how can i get the absolute screen coordinates of the html/body? I found all those window.screenTop, screenLeft, outerheight/innerHeight - but thats not the solution. EDIT: I updated the image to clarify what I need!

Original source

Related problems