1
...
<div class="preview-list" data-layout="sidebar">

</div>
...

There is an array of elements that need to be dynamically inserted into an empty div with the "preview-list" class using javascript. When scrolling, you need to remove the invisible 5 elements from the div and add 5 elements from the bottom. If the user scrolls up, you need to remove the lower invisible 5 elements from the div and add the new 5 elements at the top. Also need to keep the order of the elements in the array when dynamically adding/removing elements from div

Tried to do as stated here: Dynamically add and remove the div on scroll?

This is similar to what is needed (the answer is marked as a solution to the problem from the link above), but it does not work to make the scrolling vertical (up-down), in the example above, the scrolling is horizontal

(Sorry for my English)

Khava
  • 66
  • 1
  • 5
  • http://idownvotedbecau.se/noattempt/ – Jejun Apr 28 '21 at 06:02
  • Does this answer your question? [Dynamically add and remove the div on scroll?](https://stackoverflow.com/questions/29388755/dynamically-add-and-remove-the-div-on-scroll) – thuva4 Apr 28 '21 at 06:12

0 Answers0