Last active
August 30, 2016 21:10
-
-
Save mrowa44/b98869fa58fcbdfb6e33faaaeff2149e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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