Over a million developers have joined DZone.

Get Element's Offsets

·
Retrieves the element's offsets


//+ Jonas Raoni Soares Silva
//@ http://jsfromhell.com
function getOffset(o){
	for(var r = {x: o.offsetLeft, y: o.offsetTop, h: o.offsetHeight, w: o.offsetWidth}; o = o.offsetParent; r.x += o.offsetLeft, r.y += o.offsetTop);
	return r;
}
Topics:

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}