Created
April 8, 2013 11:32
-
-
Save MaciekBaron/5336138 to your computer and use it in GitHub Desktop.
A cross-browser function to retrieve the window's `scrollTop`
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getScrollTop() { | |
if (typeof window.pageYOffset !== 'undefined'){ | |
return window.pageYOffset; | |
} else { | |
var iequirks = document.body; | |
var iedoctype = document.documentElement; | |
var doc = (iedoctype.clientHeight) ? iedoctype : iequirks; | |
return doc.scrollTop; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment