To get the position of an html element, position()
method can be used that gives the position object which can be used to determine the left and top position relative to its parent element.
<script>
var position = $("h1").position();
alert(position.left + " : " + position.top);
</script>
Above code snippet will find the position object for the “h1” element. That position object will have left and top properties that is used to retrieve its left and top position relative to its parent element.
Views: 4601 | Post Order: 55