diff options
author | Ev Bogue <ev@evbogue.com> | 2020-01-25 16:03:17 -0600 |
---|---|---|
committer | Ev Bogue <ev@evbogue.com> | 2020-01-25 16:03:17 -0600 |
commit | 16d261f8a2cb44d5364f5a993b800664236f4318 (patch) | |
tree | 08a19b2103a3ffa02cb93b0659acdc0017addc93 | |
parent | cf84b3234e9856c5dbf0d25fdcbc4c227d4325cc (diff) |
predictive scrolling
-rw-r--r-- | views.js | 11 |
1 files changed, 6 insertions, 5 deletions
@@ -150,13 +150,14 @@ function profilePage (src, keys) { bog().then(log => { var index = 0 if (log) { - var posts = log.slice(index, index + 25) + var posts = log.slice(index, index + 33) addPosts(posts, keys).then(done => { - index = index + 25 + index = index + 33 window.onscroll = function(ev) { - if (((window.innerHeight + window.scrollY) >= document.body.scrollHeight) && (window.location.hash.substring(1) === src)) { - posts = log.slice(index, index + 25) - index = index + 25 + console.log(document.body.scrollHeight) + if (((window.innerHeight + window.scrollY) >= (document.body.scrollHeight - 2500)) && (window.location.hash.substring(1) === src)) { + posts = log.slice(index, index + 33) + index = index + 33 addPosts(posts, keys) console.log("Bottom of page") } |