Created
July 23, 2015 12:11
-
-
Save Razenbull/b250fe239e8cd264ba24 to your computer and use it in GitHub Desktop.
Test if an element is at the top of the document
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
/** | |
* | |
* @param $element = element offset to test against $(window).scrollTop() | |
* @returns {boolean} | |
*/ | |
function testOffset($element) { | |
var windowScroll = $(window).scrollTop(), | |
elementOffset = $element.offset().top; | |
return (windowScroll >= elementOffset); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment