Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>?</title>
  <style>
    #elem {
      background-color: #000;
      height: 100px;
      width: 100px;
      position: fixed;
    }
  </style>
  <script class="jsbin" src="http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.js"></script>
</head>
<body>
  <p>Click the document to position the box.</p>
  <p>The first time the box will be positioned incorrectly because the left and top style properties are not defined.</p>
  <p>Subsequent clicks will position the box properly.</p>
  
  <div id="elem"></div>
  
</body>
</html>
 
$( document ).click(function() {
  $( "#elem" ).offset({ top: 100, left: 100 });
});
Output

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
anonymouspro
0viewers