# Preserving scroll position

**URL:** <https://forum.readymag.com/t/preserving-scroll-position/3446>\
**Category:** General topics\
**Created:** [August 28, 2024, 3:59pm UTC](https://forum.readymag.com/t/preserving-scroll-position/3446 "2024-08-28T15:59:43Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Vegard\_Szilvay](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.readymag.com/vegard_szilvay/32/2361_2.png) [@Vegard\_Szilvay](https://forum.readymag.com/u/Vegard_Szilvay)\
**Post date:** [August 28, 2024, 3:59pm UTC](https://forum.readymag.com/t/preserving-scroll-position/3446/1 "2024-08-28T15:59:43Z")

</div>

Is there a way of preserving scroll position whenever clicking back and forth between pages? Meaning i’m for instance halfway down a page, click onto a new page at the nav bar at the top, and keeping my position halfway down the page when clicking return? Im currently on the free plan, and havent found a way do to this.

---

<div class="post-metadata">

**Author:** ![neueMeta](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.readymag.com/neuemeta/32/92_2.png) [@neueMeta](https://forum.readymag.com/u/neueMeta)\
**Post date:** [September 16, 2024, 10:56am UTC](https://forum.readymag.com/t/preserving-scroll-position/3446/2 "2024-09-16T10:56:10Z")

</div>

you can store the current scrollposition in a local storage before changing the page.

this would look like this:

```auto
< script>

  setTimeout(function() {

   $(window).unload(function() {
      var scrollPosition = $(".content-scroll-wrapper").scrollTop();
      localStorage.setItem("scrollPosition", scrollPosition);
   });
  
   if(localStorage.scrollPosition) {
      $(".content-scroll-wrapper").scrollTop(localStorage.getItem("scrollPosition"));
   }

  }, 1000); 
  
  
  
< /script>

```

(erase the blank characters inside the “script” brackets)
