Infinite Scroll with Dynamic Content

Hi everyone.

I’ve been working on a site for an art gallery with video-led content. I’ve got infinite scroll working using some code from a Webflow article, but the problem is that it works by changing the URL. So once you navigate away by clicking on an object beyond the first ‘page’ (for example the 10th object) and press ‘back’ in the browser, it goes back to that paginated URL meaning you can’t see the objects before it.

There also seems to be an issue where the video no longer corresponds to the collection item once you go back using the browser in the above scenario – a little weird.

Is there a bit of code that forces the browser to go back to the root grid objects page rather than the specific paginated URL it was at? Or is there a better workaround?

Thanks so much for you help!


Here is my site’s Read-Only link.

And the site is currently published here.