jQuery position()Method
Examples
Return the top and left position of a <p> element:
$("button").click(function(){
x=$("p").position();
alert("Top: " + x.top + " Left: " + x.left);
});
Try it yourself »
Definition and Usage
The position() method returns the position of the first matched element (relative to its parent element).
This method returns an object with two properties (the top and left positions in pixels).
Syntax
$(selector).position()
More Examples
Return the position of an element relative to its parent element
How to get the position of a <p> element inside a <div> element.
Other Extensions
jQuery
HTML/CSS Methods