How can you organize the loading of elements as, for example, it is done in Instagram (adding photos when scrolling to the end of the page):

123

Pink, the inspector marks the items that have just been added to the house. How to do this on a static site (that is, without php), but through js? And is it even possible?

  • 2
    ajax request, which receives new elements in the response, which are then inserted into the DOM. Data from somewhere you need to take (pictures), so the ajax request. If you just need to add new elements when scrolling, you can simply put some restriction on the onscroll event (for example, the height of the window or the current position of the scroll), which will add elements to the DOM ( $(".block").append("<div></div>") ) - alexoander
  • @alexoander, thanks, I'll dig) - VostokSisters

0