I have some elements positioned via CSS this way:
#myItem{
position: absolute;
left: 50%;
margin-left: -350px;
}
I’d like to get their distance from top and left margin of the page.
How can I get those measure with javascript/jquery?
Thanks
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Take a look at jQuery’s
.position()
and
.offset()
EDIT: As mentioned by @Nick, .offset() is what you want if you need the position relative to the document