Turning off auto scroll to top of page Dawn 2.0

Turning off auto scroll to top of page Dawn 2.0

Sunnydjl
Visitor
2 0 1

Hi,

Is it possible to allow my customers to return to the same area of the page they were at previously? Currently when a customer clicks on the back button, it returns them to the previous page but they have to start at the very top. Hope that makes sense. Thanks for your help. 

Replies 3 (3)

Sunnydjl
Visitor
2 0 1

Never mind, didn’t realize that I needed a back button. I added one and all is well. 

StefanBoettjer
Shopify Partner
16 1 7

Hi Sunnydjl,

 

1. go to Online Store —> Themes

2. Click on Action and duplicate your theme for an Backup.

3. Click on Action again, Edit Code

4. Open your theme.liquid file.

5. Find the following code line (3 lines in total, you just need the middle one. ) Remove the line: 

 

<main id="MainContent" class="content-for-layout focus-none" role="main" tabindex="-1">

 

Also remove the third line

 

</main>



6. Press Save

7. Reload your page and try it.

 

Works also on mobil.

 

hope that helps.

Reason is, that with this code line some content will not be loaded completely after the page load is done. So if you go to a new page there is no Y-Scroll Position to remember in case if you press the back button.

 

Have a great day, all my best, 

 

Stefan 

 

 

Berits_Interiør
Visitor
2 0 0

I had the same issue and removing this specific line of code you mentioned worked! Thank you so much!