Finding the Scroll Position in IE10

It’s been so long since I had to deal with IE that I had forgotten about this, but IE does not support window.scrollX/window.scrollY; you have to use something like:
var top = typeof window.scrollY === "undefined” ? window.pageYOffset : window.scrollY;

One more teeny difference for the mobile web! :-)

8 Responses to Finding the Scroll Position in IE10

  1. Chad says:

    I know this is an old post, but it resolved my issue nicely; thanks for posting.

  2. ae says:

    But (window.scrollY || window.pageYOffset)
    as (0 || undefined ) returns undefined

  3. The cross-browser compatible version for `window.scrollY` is `document.documentElement.scrollTop`

    • Steve S. says:

      Near as I can tell, it isn’t. I spent the last hour trying to get that to play nice across Chrome, Firefox and Safari, and ultimately window.scrollY was the only thing that worked for all of them.

  4. Christian says:

    thank you!

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.