Skip to content

Instantly share code, notes, and snippets.

@ourmaninamsterdam
Last active August 29, 2015 14:08
Show Gist options
  • Save ourmaninamsterdam/2aeb3d699bdd99f26aa6 to your computer and use it in GitHub Desktop.
Save ourmaninamsterdam/2aeb3d699bdd99f26aa6 to your computer and use it in GitHub Desktop.
Check if element is within viewport
Popover.prototype.isOverlappingViewport = function($el) {
return this.getElementBoundaries($el).top < 0? true : false ||
this.getElementBoundaries($el).bottom > $('body').height()? true : false ||
this.getElementBoundaries($el).left < 0? true : false ||
this.getElementBoundaries($el).right > $('body').width()? true : false;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment