Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Get position of tag minus position of parent relative tag

Status
Not open for further replies.

jgd1234567

Programmer
May 2, 2007
68
GB
Hi, I have a couple functions to return the position of a tag. I'm hoping i can then use this to position an absolute positioned tag on top of this tag. However since this returns the position from the edge of the browser, if i have a parent element which has relative positioning the element is absolute positioned tag is displayed incorrectly. Therefore to make things abit clearer i need to say something like:

function getPosition(element) {
return element x coordinate (from browser) - parent relative positioned tag coordinate (from browser)
}

You might have guessed the above code doesn't work :). Appreciate if someone could help. Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top