Last active
November 16, 2016 04:03
-
-
Save Blainegunn/f3addd6a7c659d68a88c662e78fb4986 to your computer and use it in GitHub Desktop.
test code for myfeed
This file contains hidden or 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
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