Retain Scroll Position

Hello I’m working on website like this
when I navigate to another page and go back the plane starts from starting. How do I make the plane start from the position I left?

Remember the scroll position (or the plane position). And when you come back, restore the scene at that position.

For storing, you can use:

  • the Local storage
  • a cookie (and everyone will start to hate you)
  • pass it to the other page (via POST or GET), and when returning from there, that page will give that position back (via POST or GET)
  • and maybe 10 other different ways.
1 Like

Ok I got it. Does the scroll restoration from react router dom works?

I’m not familiar with React. My guess is that everything possible without React should be possible with React too.

Yaa got it.

Thank you

1 Like

When I started with three.js, I tried out local storage. raycaster - drag and drop


It was helpful.

Thank you.

it’s called scroll restoration, it’s fairly common