$offset
Get current coordinates of element.
$offset( element )
element [object]
The target element.
Notes
This function will return the object with top and left value of the target element. It is useful to get the actual position of the element on the page.
Example
HTML code
<div id="box">This is a box</div> <button onclick="start_offset()">Get box offset</button>
CSS code
#box {
width: 200px;
height: 60px;
font-size: 12px;
background: #5599bb;
padding: 10px;
}JavaScript code
function start_offset()
{
var offset = $offset( $("box") );
alert( "top: " + offset.top + "px left: " + offset.left + "px" );
}
Demonstration
This is a box