A better way to get the topleft of the Virtual Earth Control

posted in: Uncategorized | 0

johnWeeGo.jpgFor some reason the built in gettop and getleft methods from Virtual earth don’t work consistantly across all interfaces. Try this more generic function instead.


function SetMapOffsets(obj) {
	if (obj.offsetParent) {
		mapleft = obj.offsetLeft
		maptop = obj.offsetTop
		while (obj = obj.offsetParent) {
			mapleft += obj.offsetLeft
			maptop += obj.offsetTop
		}
	}
}