title: javascript scroll to bottom of div if current scroll location is near bottom
body: <p>I am working on a script that will append text (varies on size) to a div block  (varies in height) with overflow scroll. After this text is appended I need the div block to be scrolled to the bottom in order to see the new appended text, however I need it only to scroll to the bottom if the current scroll position is around 10% of scroll close to the bottom, otherwise it would be annoying if it scrolled down while viewing the top portion of the div.</p>
  
  <p>This is what I came up with, it is run after text is appended:</p>
  
  <pre><code>var divblock = document.getElementById('div'); //the block content is appended to
  var divheight = divblock.offsetHeight;//get the height of the divblock
  //now check if the scroller is near the bottom and if it is then scroll the div to the abslute bottom
  
  if (***HELP HERE***) divblock.scrollTop=divblock.scrollHeight; ///scroll to bottom
  </code></pre>
  
  <p>much appreciated thanks!</p>