Skip to content

Instantly share code, notes, and snippets.

@christopherbauer
Created February 17, 2016 20:48
Show Gist options
  • Select an option

  • Save christopherbauer/770aa123b7ee33c1c421 to your computer and use it in GitHub Desktop.

Select an option

Save christopherbauer/770aa123b7ee33c1c421 to your computer and use it in GitHub Desktop.
function isAnyPartOutsideViewPort($element) { //THIS SHOULD BE LIB FUNCTION
var element = $element[0];
var rect = element.getBoundingClientRect();
return rect.top <= 0 ||
rect.left <= 0 ||
rect.bottom >= $(window).height() ||
rect.right >= $(window).width();
}
@christopherbauer
Copy link
Copy Markdown
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment