title: On scroll load data on demand
body: <p>I am implementing on demand loading of data through scrolling.</p>
  <p>I have register the function in <code>document.ready</code> for a div.</p>
  <p>The data should only be populated once the scroll is reached to the last. so to identify whether the scroll has reached till the last i am using the below function.</p>
  <pre><code>$(&quot;#tree&quot;).scroll(function () {
                  if (isScrolledToBottom(this)) {
                      
                  }
              });
  </code></pre>
  <p>But the function is not returning the correct value. What I mean is it should return the a true value when scroll has reached to its last.</p>
  <pre><code>function isScrolledToBottom(object) {
              return ($(object).attr('scrollHeight') - $(object).scrollTop() - 1) &lt;= $(object).height();
          };
  </code></pre>