ScottoCat Posted June 22, 2023 Posted June 22, 2023 Hello, I have had code that has worked for years where when you hit the back arrow you return to where you were on the scroll. It's important with my site, especially on mobile. The back arrow is returning you to the top of the page rather than where you left off. I remember i got code to insert. I am also not sure why it suddenly stopped working.
Simon Posted June 22, 2023 Posted June 22, 2023 If the back button is to a specific page section, have you tried using an anchor? /* Anchor on the page section just above the item you want to target */<span id="mything"></span> And on the back button the link is ../#mything
ScottoCat Posted June 22, 2023 Author Posted June 22, 2023 Here is the script now: Sorry, it wouldn't allow copy.paste
ScottoCat Posted June 23, 2023 Author Posted June 23, 2023 Thanks for the response Simon, What i had set up was script that would allow you to return to your place on these busy pages you were after going to an album (post). Soon i will have 1100 pages on the site. This script was working up until today
creedon Posted June 23, 2023 Posted June 23, 2023 SS is making changes all the time. Perhaps a change has rendered your code inoperable. Please post the URL for a page on your site where we can see your issue. A link to the backend of the your site won’t work for us, i.e. a url that contains /config/. Please set up a site-wide password, if your site is not public and you've not already done so. Post the password here. Adding a site-wide password does not allow anyone to alter your site. It only allows those with the password to see your site. Please read the site-wide password and how to share a link documentation to understand how they work. We can then take a look at your issue. You may find How to post a forum question post useful. Find my contributions useful? Please like, upvote, mark my answer as the best ( solution ), and see my profile. Thanks for your support! I am a Squarespace ( and other technological things ) consultant open for new projects.
ScottoCat Posted June 23, 2023 Author Posted June 23, 2023 Hey Creedon, thanks. Here is a page: https://top1000albums.com/300s If you scroll down to the middle or lower click on any album, then hit the back arrow and you will see what I mean. I'll look into getting the site wide password
creedon Posted June 24, 2023 Posted June 24, 2023 Quote I'll look into getting the site wide password You don't need one if your site is already public. Find my contributions useful? Please like, upvote, mark my answer as the best ( solution ), and see my profile. Thanks for your support! I am a Squarespace ( and other technological things ) consultant open for new projects.
ScottoCat Posted June 24, 2023 Author Posted June 24, 2023 it is public. Anyone can go to it. Are you saying that you would need access to the backend?
creedon Posted June 24, 2023 Posted June 24, 2023 Quote Are you saying that you would need access to the backend? No. We don't need access to the backend. Find my contributions useful? Please like, upvote, mark my answer as the best ( solution ), and see my profile. Thanks for your support! I am a Squarespace ( and other technological things ) consultant open for new projects.
ScottoCat Posted June 24, 2023 Author Posted June 24, 2023 Does that script need to be altered or do I add another. I went to developer section and was not able to copy where the JS was added in the footer code injection part. It looks like i have to upgrade to be able to unlock that section
ScottoCat Posted June 24, 2023 Author Posted June 24, 2023 I had to upgrade my plan to be able to unlock the code injector. Now I just need code that will do what it did before. Here is the code now that I can copy/paste: <script type="text/javascript"> function refreshPage () { var page_y = document.getElementsByTagName("body")[0].scrollTop; window.location.href = window.location.href.split('?')[0] + '?page_y=' + page_y; } window.onload = function () { setTimeout(refreshPage, 3600000); if ( window.location.href.indexOf('page_y') != -1 ) { var match = window.location.href.split('?')[1].split("&")[0].split("="); document.getElementsByTagName("body")[0].scrollTop = match[1]; } } </script>
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment