title: Can't get scroll position
body: <p>I have a page whose body is scrolling. That is, a scroll event listener on <em>body</em> works. However, scroll listeners on <em>window</em> and <em>document</em> does not fire.</p>
  
  <p>The problem is, even though body is scrolling, $("body").scrollTop() returns 0 all the time. I looped through ALL the children of body and none of them has scrollTop() greater than 0. Some of the children has overflow: hidden but that should not affect scrollTop I guess.</p>
  
  <p>I removed height: 100% as per <a href="https://stackoverflow.com/questions/12788487/document-scrolltop-always-returns-0">this</a> question and I've also gone through <a href="https://stackoverflow.com/questions/22173454/jquery-scrolltop-returns-0-for-all-elements">this</a> question. </p>
  
  <p>And I made sure it is indeed <em>body</em> that is scrolling by setting its overflow as hidden - the scroll bar disappeared. And I also tried attaching scroll listeners on every container div in the application - none of them fired. So it is indeed the <em>body</em> that is scrolling and for some weird reason jquery scrollTop() returns 0 for all the elements.</p>
  
  <p>And yes, I tried accessing document.body.scrollTop - still 0.</p>
  
  <p>Any hints as to what might be causing this issue will be received with a LOT of gratitude. Been stuck here for a while. Thanks :)</p>
  
  <p><strong>EDIT</strong>: document.documentElement.scrollTop also returns 0. $(document).scrollTop() - returns 0.
  !DOCTYPE html is also set.</p>
  
  <p><strong>EDIT 2:</strong> Strangely enough, I can't also scroll by setting scrollTop on body. That is, $('body').scrollTop(500) does nothing!</p>
  
  <p><strong>EDIT 3:</strong>: 
  My jquery function: </p>
  
  <pre><code>$("body").on("scroll", function(){
      var children = $("body").children();
      $("body").scrollTop(800);
      for(var i=0; i&lt;children.length; i++){
          if($(children[i]).scrollTop() &gt; 0){
              console.log("children: " + i);
              console.log("val: " + $(children[i]).scrollTop());
          }
      }
  });
  </code></pre>