.scrollTop is failing (as is animation for it)

.scrollTop is failing (as is animation for it)

I have a div on my page which overflows (beyond a max height of 500px). I have previously set overflow:hidden, but I now have overflow:scroll to confirm that there is indeed a vertical scrollbar.

But when using this code:
  1. $(document).ready(function() {
  2. alert($("body").scrollTop(50).scrollTop());
  3. alert($("#gallerybuttons").scrollTop(50).scrollTop());
  4. });
The 1st alert says: "50". The 2nd alert says: "0".

What's even more odd, is if I do the same thing with #supplierdiv (another div that scrolls), it works (displays "50" and scrolls) when I load the page via another link. However, if I refresh, it says "0" and does not scroll.

What on earth is going on?