Skip to content

Instantly share code, notes, and snippets.

@brecht
Last active August 29, 2015 14:27
Show Gist options
  • Select an option

  • Save brecht/a96ba4dcdaaded151539 to your computer and use it in GitHub Desktop.

Select an option

Save brecht/a96ba4dcdaaded151539 to your computer and use it in GitHub Desktop.
isPartlyInView (vanillaJS)
// inspired by https://gist.github.com/jjmu15/8646226
var isPartlyInView = function isPartlyInView(element) {
var rect = element.getBoundingClientRect();
var html = document.documentElement;
return (rect.bottom > 0 && rect.top < (window.innerHeight || html.clientHeight));
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment