Skip to content

Instantly share code, notes, and snippets.

@poteto
Last active August 29, 2015 14:10
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 poteto/90f69c615294a0fdc137 to your computer and use it in GitHub Desktop.
Save poteto/90f69c615294a0fdc137 to your computer and use it in GitHub Desktop.
enteredViewport: Ember.computed('boundingClientRect', 'windowHeight', 'windowWidth', function() {
var rect, windowHeight, windowWidth;
rect = this.get('boundingClientRect');
windowHeight = this.get('windowHeight');
windowWidth = this.get('windowWidth');
return (
rect.top >= 0 &&
rect.left >= 0 &&
rect.bottom <= windowHeight &&
rect.right <= windowWidth
);
}),
exitedViewport: Ember.computed.not('enteredViewport'),
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment