Q:

Jquery Scroll to BOTTOM to load new content is working in opposite way (i.e) on Scrolling TOP

I am working on a website, which has scroll to BOTTOM to load AJAX content.
I use this Jquery Scroll function:
$(window).scroll(function() { 

  if($(window).scrollTop() + $(window).height() == $(document).height())  
    {

      alert("ScrollTop + Window Height = "+$(window).scrollTop()+ " + " +
      $(window).height()+ " == Document Height = "+$(document).height());

      // This get's alerted only when i reach TOP
    }

  });

But this works only if i reach TOP
Do anyone had this problem before ?

A:

I found a solution for this issue,
Its My Mistake that, i didn't include doc type in my html code. 
<!DOCTYPE html>

And that's why the scroll worked in reverse order. After including the doctype at the 1st line of the code, it's working good as expected (i.e) Scrolling to the bottom of page to load more AJAX content or call function().
So when ever you write a code start with < !DOCTYPE html > 

