Jump to content

Can anybody help to solve this problem

Recommended Posts

I saw a lot of people has encountered this problem, so let's break it down for the last time so that everybody will save a lot of time. 

I have a code that makes you go back to your last scroll point when using browsers back button, but when entering a page it just randomly takes you to the bottom of it, chatgpt is useless for this, would be a lifesaver if somebody would help with it. 

Here's the code: 

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>

<script type="text/javascript">
$(document).ready(function () {

    if (localStorage.getItem("my_app_name_here-quote-scroll") != null) {

    $(window).on("scroll", function() {
        localStorage.setItem("my_app_name_here-quote-scroll", $(window).scrollTop());

Link to comment
  • Replies 0
  • Views 1k
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Create an account or sign in to comment

You need to be a member in order to leave a comment

  • Create New...

Squarespace Webinars

Free online sessions where you’ll learn the basics and refine your Squarespace skills.

Hire a Designer

Stand out online with the help of an experienced designer or developer.