P
P
pavuuuk2019-08-13 14:12:48
MongoDB
pavuuuk, 2019-08-13 14:12:48

How to load articles as you scroll?

I wanted to make a small workout blog. There will be many articles that should load as you scroll. So, I just recently started learning node.js and I don’t quite understand how to implement it. Can you briefly describe the mechanism: what should the client-side and server-side code do? Also, I want to use mongoDB to store and add articles.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
H
hzzzzl, 2019-08-13
@pavuuuk

you save the number of elements on the page in the browser, for example articlesLoaded = 10
when you scroll to the last loaded element on the page, the browser makes a request to the server, receives a response and draws new elements, at the same time saves the new number of elements on the page, for example articlesLoaded = articlesLoaded + 10
on the server side / mongo you make a similar request
https://beginnersbook.com/2017/09/mongodb-limit-an...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question