Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
aniview Entering Viewport
* returns boolean representing whether element's top is coming into bottom of viewport
* @param HTMLDOMElement element the current element to check
function EnteringViewport(element) {
var elementOffset = $(element).offset();
var elementTop = + $(element).scrollTop();
var elementBottom = + $(element).scrollTop() + $(element).height();
var viewportBottom = $(window).scrollTop() + $(window).height();
return (elementTop < (viewportBottom - settings.animateThreshold)) ? true : false;
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.