Skip to content

Instantly share code, notes, and snippets.

@mrowa44
Last active August 30, 2016 21: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 mrowa44/b98869fa58fcbdfb6e33faaaeff2149e to your computer and use it in GitHub Desktop.
Save mrowa44/b98869fa58fcbdfb6e33faaaeff2149e to your computer and use it in GitHub Desktop.
function shouldLoadMore(component, node, offset) {
if (typeof component.needsMoreItems === 'function' && component.needsMoreItems()) {
return true;
} else if (node) {
const rect = node.getBoundingClientRect();
const innerHeight = window.innerHeight;
return rect.top + rect.height > innerHeight && innerHeight > rect.bottom - offset;
}
return false;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment