Answer the question
In order to leave comments, you need to log in
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
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 questionAsk a Question
731 491 924 answers to any question