Created
January 13, 2011 16:32
-
-
Save danheberden/778141 to your computer and use it in GitHub Desktop.
Find what the hell to scroll
This file contains 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
var $docEl = $( document.documentElement ), | |
$body = $( document.body ), | |
// if docEl has a scrollTop, well, that kinda answers our question | |
$scrollable = $docEl.scrollTop() ? $docEL : | |
$body.scrollTop( $body.scrollTop() + 1 ).scrollTop() ? $body : $docEl; | |
// its like we can already tell! | |
if ( windowST ) { | |
$scrollable = $docEl; | |
}else { | |
// if adding one to body doesn't help us out, we're in docEl land | |
if ( !$scrollable.scrollTop( bodyST + 1 ).scrollTop() ) { | |
$scrollable = $docEl; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment