title: Find the bottom height of a scroll div?
body: <p>We have a div, and I need to find the maximum scroll height size of it.
  My chat, currently, with 12 messages, has 800px height, but when I use this code:</p>
  
  <pre><code>var trueDivHeight = $('#chat')[0].scrollHeight;
  </code></pre>
  
  <p>It will only find out the height of the div, not the whole scroll to down, it will say 490px.
  But I want to find the maximum height, to the bottom.</p>
  
  <p>From top, to bottom of the scroll.</p>
  
  <p><strong>Why do I need this?</strong> to solve this bounty question by me: <a href="https://stackoverflow.com/questions/17235892/ajax-chat-automatically-drag-the-scroll-down-but-dont-drag-it-when-the-user">AJAX Chat - Automatically drag the scroll down, but don&#39;t drag it when the user is scrolling up?</a></p>
  
  <p>Basically what I can do is, when sending a message, do checking:</p>
  
  <pre><code>if (checkScroll(trueDivHeight)) { //Runs the function checkScroll with max div height.
      scrollDown = true; // turn true if it was true.
  }
  
  if (scrollDown) {
      setInterval(function () {
          scrollToBottom(); // scroll to bottom 1 second after posted message..
      }, 1000);
  }
  </code></pre>
  
  <p>and the functions I can use:</p>
  
  <pre><code>function scrollToBottom() {
      $('#chat').scrollTop(bottom); // Makes scroll go to the most bottom.
  }
  
  function checkScroll(size) {
      if ($("#chat").scrollTop() == size) { // Checks if current scroll position equals to the max bottom position.
          return true; // if yes, return true.
      }
  }
  </code></pre>
  
  <p><em>But problem is, that trueDivHeight doesn't find the whole height of the scroller, from top to bottom. if it did, then it would work for me.</em></p>
  
  <p><strong>Any ideas?</strong></p>
  
  <p>EDIT:</p>
  
  <pre><code>var trueDivHeight = $('#chat')[0].scrollHeight; // finds the max bottom px
  var divHeight = $('#chat').height();
  var bottom = $('#chat')[0].scrollHeight;
  </code></pre>