Distance tweaks for hidden loads
This commit is contained in:
parent
dc3039ef8b
commit
5fbb29f7fb
1 changed files with 2 additions and 1 deletions
|
@ -18,6 +18,7 @@
|
||||||
// Infinite loading function
|
// Infinite loading function
|
||||||
const onInfinite = ({ detail: { loaded, complete } } : { detail : { loaded : () => void, complete : () => void}}) => {
|
const onInfinite = ({ detail: { loaded, complete } } : { detail : { loaded : () => void, complete : () => void}}) => {
|
||||||
getNextPosts().then((newPosts) => {
|
getNextPosts().then((newPosts) => {
|
||||||
|
console.log("Loading next posts...");
|
||||||
if (newPosts.length > 0) {
|
if (newPosts.length > 0) {
|
||||||
posts = [...posts, ...newPosts];
|
posts = [...posts, ...newPosts];
|
||||||
loaded();
|
loaded();
|
||||||
|
@ -53,7 +54,7 @@
|
||||||
<PostComponent post={postObject as Post} />
|
<PostComponent post={postObject as Post} />
|
||||||
{/each}
|
{/each}
|
||||||
<InfiniteLoading on:infinite={onInfinite}
|
<InfiniteLoading on:infinite={onInfinite}
|
||||||
distance={0}
|
distance={3000}
|
||||||
/>
|
/>
|
||||||
<div id="spacer"></div>
|
<div id="spacer"></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue