title: jQuery Animation and window resizing
body: <p>I think the best way to ask this is to just show the code:</p>
  
  <pre><code>var counter = 1;
  $('#animation').click(function () {
      if (!$('h2').is(':animated')) {
          if (counter == 5) {
              toTheRight = !toTheRight;
              counter = 0;
          }
          var movement = (.2 * $('h2').width()) + "px";
          if (toTheRight) {
              $('h2').animate({
                  "font-size": "2.2em",
                  "width": "50%",
                  "left": "+=" + movement
              }, { queue: false, duration: 1000 });
          }
          else {
              $('h2').animate({
                  "font-size": "2.2em",
                  "width": "50%",
                  "left": "-=" + movement
              }, { queue: false, duration: 1000 });
          }
          counter++;
      }
  });
  </code></pre>
  
  <p>This function works very nicely for a window that stays the same size from start to finish.  I was wondering if there is an elegant way to handle window resizes short of just reseting the current position of the element all the way back to the left.  </p>
  
  <p>Note: if in full screen mode and the element is all the way to the right, reducing the screen and not adjusting the elements position results in the element being scrolled to the right of the screen.</p>
  
  <p>Thanks for any advice you can give.</p>