jQuery日本語リファレンス

jQuery does not mean Japanese Query...

Css/API/jQuery - Sample Code

position()


            
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
                    "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
  <script src="http://code.jquery.com/jquery-latest.js"></script>
  
  <script>
  $(document).ready(function(){
    var p = $("p:first");
var position = p.position();
$("p:last").text( "left: " + position.left + ", top: " + position.top );
  });
  </script>
  <style>
  div { padding: 15px;}
  p { margin-left:10px; }
  </style>
</head>
<body>
  <div><p>Hello</p></div><p></p>
</body>
</html>
            
          
[実行結果]
[position() の説明へ]