Created
November 7, 2018 10:36
-
-
Save fergusKe/0bc3cbe50b926b5fde0ed34253d9128e to your computer and use it in GitHub Desktop.
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
function isScrolledIntoView(elem) { | |
var docViewTop = $(window).scrollTop(); | |
var docViewBottom = docViewTop + $(window).height(); | |
var elemTop = $(elem).offset().top; | |
var elemBottom = elemTop + $(elem).height(); | |
return (elemTop <= docViewBottom) && (elemBottom >= docViewTop); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment