How to handle new data addition on infinite scrolling DOM -
i had question thought needed expert advice. have infinitely scrollable div
loaded list, 10 @ time. works fine if there no changes in list.
i have form prepends list new item , hence disturbs sequence of infinite scroll i.e. last item in displayed content repeated.
i'd thankful if advice me how handle condition. things tried do,
- splicing last item in displayed content. (vague way, not useful if list prepended multiple items)
- keeping track of how many items prepended , passing
skip = <number_of_prepended_items>
argument server skip these newly added items (works fine feel break) - reload first 10 items upon addition of new item.
any suggestions?
as harry pehkonen said, could, example, give each item id
value, increment 1 each new element. can request first 10 items after id server, in case lowest id on page (literally). give first 10 items not have , prevent duplicates.
Comments
Post a Comment