title: How to get "fixed" position of an element?
body: <p>I want to get an element's position relative to the window (fixed position).</p>
  
  <p>Here's what I've got so far:</p>
  
  <pre><code>(function ($) {
      $.fn.fixedPosition = function () {
          var offset = this.offset();
          var $doc = $(document);
          return {
              'x': offset.left - $doc.scrollLeft(),
              'y': offset.top - $doc.scrollTop()
          };
      };
  })(jQuery);
  
  $('#thumbnails img').click(function () {
      var pos = $(this).fixedPosition();
      console.log(pos);
  });
  </code></pre>
  
  <p>But when I click a thumbnail, it appears to be off by about 10 pixels or so. i.e., it will give me negative values for <code>y</code> even when the top edge of the photo is about 5 pixels away from the top of my browser window.</p>