title: Positioning Context Menu
body: <p>I'm trying to position a custom context menu with jQuery.<br>
  The first time it appears at the right position (mouse coordinates), but then the current position is being summed up with the new position, so that the menu disappears from the screen.<br>
  Here is the JavaScript:</p>
  
  <pre><code>&lt;script&gt;
  $(function(){
      $('#box').hide();
  
      $(document).bind("contextmenu", function(e) {
          $("#box").offset({left:e.pageX, top:e.pageY});
          $('#box').show();
          e.preventDefault();
      });
  
      $(document).bind("click", function(e) {
          $('#box').hide();
      });
      $('#box').bind("click", function(e) {
          $('#box').hide();
      });
  });
  &lt;/script&gt;
  </code></pre>