jQuery Tutorial


jQuery Example


jQuery References


jQuery CSS offset() Method Reference


  jQuery CSS method References


Uses

jQuery offset() method set and returns the relative position for selected elements.


Syntax

$(selector).offset(value)   

jQuery CSS offset() method Example

<script type="text/javascript"> 
$(document).ready(function(){
  $("button").click(function(){
    $("p").offset({left:20,top:100});
  });
});
<script>
Online Try This Code Your Self....   »

2nd offset() Method Syntax

$(selector).offset()

jQuery offset() method 2nd Example

<script type="text/javascript"> 
$(document).ready(function(){
  $("button").click(function(){
    Page=$("p").offset();
    $("span").text("LeftSide offset: " + Page.left + 
    " TopSide offset: " + Page.top);
  });
});
<script>
Online Try This Code Your Self....   »

  jQuery CSS method References