title: JQuery animate scrollTop Not Working Properly
body: <p>The following JQuery code scrolls the page to the first error in the form:</p>
  
  <pre><code>$('html,body').stop().delay(500).animate({scrollTop: $errors.filter(":first").offset().top -30},'slow');
  </code></pre>
  
  <p>However, if I replace the <code>$('html,body')</code> with the name of a container element such as a div class <code>$('.myDivClass')</code> with fixed positioning, it doesn't seem to work well. It just scrolls to random places up and down with each submission. If the container element is anything other than html,body, it doesn't seem to work right.</p>
  
  <p>I can't figure out what I'm doing wrong.</p>
  
  <p>The css of the container element looks like this (so you know what I mean):</p>
  
  <pre><code>.mcModalWrap1{
  position:fixed;
  top:0;
  left:0;
  width:100%;
  padding:50px;
  background-image:url(images/overlay.png);
  overflow:auto;
  z-index:999;
  display:none;
  }
  </code></pre>
  
  <p>I have tried using position() instead of offset() for relative positioning but it didn't make a difference.</p>
  
  <p>Thank you!</p>
  
  <p><strong>Update: Looks like there is no solution for this.</strong></p>