title: How to maintain a dynamic scroll in bottom only if the user moves it to bottom?
body: <p>I have a scrollview which has content that is being refreshed (increasing it's size) by a ajax query. </p>
  
  <p>I want that (like commonly in all the ides) when the user has the scroll on the bottom, the scroll must be mantained in the bottom even when adding more text.</p>
  
  <p>I tryed to find when the scroll is in the bottom with this code:</p>
  
  <pre><code>var scrollDiv = $('#modalText');
  var height = scrollDiv[0].scrollHeight;
  if (scrollDiv[0].scrollTop==height){
   //scroll is in the bottom, must force the scroll to bottom
  }else{
   //scroll is not in the bottom, must maintain the scroll point
  }
  </code></pre>
  
  <p>The problem is that scrollDiv[0].scrollTop is not equal to scrollDiv[0].scrollHeight when the user has the scroll in the bottom I can't understand why, but it's about 900 pixels less!</p>
  
  <p>Does anyone has any solution for this?</p>