title: Change div offset when window resizes. Jquery
body: <p>I'm using Fancybox plugin. When it loads I insert an image (preview comments) next to the Close button and position it this way:</p>
  
  <pre><code>var p = $("#fancybox-close");
  var offset = p.offset();
  $("#preview_comments").offset({ top: offset.top, left: offset.left-30});
  </code></pre>
  
  <p>This way when the window is resized the image stays right as it had an absolute position. I've also tried:</p>
  
  <pre><code>function pcomments() {
      var p = $("#fancybox-close");
      var offset = p.offset();
      $("#preview_comments").offset({ top: offset.top, left: offset.left-30});
  };
  
  pcomments();
  
  $(window).resize(function() {           
      pcomments();            
  });
  </code></pre>
  
  <p>When I minimize the window, this image moves away to the right. If I continue resizing the window the image goes back to the left of the Fancybox close button but doesn't make the offset correctly (and it looks like it doesn't update on time).</p>
  
  <p>Thanks'</p>