Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
* How to get the scrolling element in charge of scrolling the viewport:
* - in Quirks mode the scrolling element is the "body"
* - in Standard mode the scrolling element is the "documentElement"
* webkit based browsers always use the "body" element disrespectfull of the specifications:
function getScrollingElement() {
var d = document;
return d.documentElement.scrollHeight > d.body.scrollHeight &&
d.compatMode.indexOf('CSS1') == 0 ?
d.documentElement :
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.