Skip to content

Instantly share code, notes, and snippets.

@laispace
Created January 15, 2015 02:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save laispace/990089d39a4bc287384f to your computer and use it in GitHub Desktop.
Save laispace/990089d39a4bc287384f to your computer and use it in GitHub Desktop.
whether an element is in view
var scrolledIntoView = function(element) {
var coords = element.getBoundingClientRect();
return ((coords.top >= 0 && coords.left >= 0 && coords.top) <= (window.innerHeight || document.documentElement.clientHeight));
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment