title: scrollTo() flickering
body: <p>I have a dynamic page where clicking a link triggers some javascript that sets some page elements to <code>display:none</code>, and thus changes the height of the page. The typical browser behavior for this is that the scroll position from the top of the page is retained. I want to retain the scroll position from the bottom instead, because the link is near the bottom of the page and I would like the user's cursor to remain over the link after it is clicked.</p>
  
  <p>The code I have to do this is:</p>
  
  <pre><code>var scrollBottom=getDocHeight()-getScrollTop();
  //do stuff to change height
  window.scrollTo(0,getDocHeight()-scrollBottom);
  </code></pre>
  
  <p>(using cross-browser functions I found to obtain document height and scroll position).</p>
  
  <p>This works fine in chrome and internet explorer, but in firefox, there is a small delay between the page height changing and the scroll position changing. As a result there is a flicker as the page quickly realigns itself, which is bothering me a great deal.</p>
  
  <p>Can anyone suggest a fix or a more natural way to remember the scroll position from the bottom of the page instead of the top?</p>
  
  <p>Thank you.</p>