While scrolling when a certain condition is true the new content to be appended to the page has to be loaded somehow, for example you call some page with an ajax call. Let's say every time you load more data you load ten items. So your current state could be the amount of times you loaded 10 more items. You could save that information e.g. by using an anchor:
www.site.tld/index.php?id=999#load_counter=5
Another possibility would be to save it with cookies. You could try at which time the "saving" of that data is the best. E.g. after every AJAX call or when leaving the page using the onbeforeunload
event.
When your page is loaded you can check if there is that kind of metadata available in the cookie or the url. If there is you can load exactly that content either by sending an AJAX request that loads the list elements that where loaded before. In my example this would be
5 * 10
because the load_counter
is 5 and on every load there were loaded 10 more items. You also can reconstruct the position. Either by also saving that information of how much the user has scrolled or by just guessing assuming that the user was looking at the last bulk of loaded items. E.g. you could scroll to the element (5-1)*10
. That's the first element of the last bulk.