Jquery Offset Code - Jquery
Simple jquery code for Offset() method
Snippet Code
The .offset() method to retrieve the current position of an element. Here you can view the source code of jQuery.offset() method.
<script type='text/javascript'>
$(document).ready(function(){
$("#demo").click(function(e) {
var offset = $(this).offset();
alert("offset-left: "+offset.left+" offset-top: "+offset.top);
});
});
</script>
<style>
div{width:100px;height:30px;background:red;margin-left:50px;}
</style>
<div id='demo' align='center'>Click me</div>
Tags