Skip to content

Instantly share code, notes, and snippets.

@Blainegunn
Last active November 16, 2016 04:03
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 Blainegunn/f3addd6a7c659d68a88c662e78fb4986 to your computer and use it in GitHub Desktop.
Save Blainegunn/f3addd6a7c659d68a88c662e78fb4986 to your computer and use it in GitHub Desktop.
test code for myfeed
var totalHeight;
var scrollTop;
var distance;
var windowHight = window.innerHeight;
window.addEventListener('scroll', function () {
var top = (document.documentElement && document.documentElement.scrollTop) ||
document.body.scrollTop;
totalHeight = document.body.offsetHeight;
scrollTop = document.body.scrollTop;
distance = scrollTop + windowHight;
console.log(distance + ' ' + totalHeight)
console.log(top + ' ' + scrollTop)
if(distance === totalHeight) {
console.log('load more');
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment