Pagination not scrolling to the top automatically

planetjuniorseo
Explorer
107 0 19

Hi

 

I have pagination on my website but it doesn't load to the top when shifting from one page to the other. Like when going to the page 2 of any collection, product page, it stays where the person clicks and use has to scroll to the top to start browsing the products.

 

I know something must be done with code but not sure what to do. I want it to scroll to top automatically like every good store has.

Here is link of the website: https://planetjunior.pk/collections/toys

Replies 2 (2)

DandelionFairy6
Visitor
2 0 0

Hi,

Just wondering if you ever figured this out? I have a similar issue that would involve code related to the pagination links. Would love to hear any insight you've discovered.

WhitetailHQ_com
New Member
4 0 0

Hello,

 

I am using the Ride Theme and this worked for me. > www.whitetailheadquarters.com
Screenshot 2024-06-08 at 9.38.20 AM.png

Steps:

  1. Go to the Shopify Admin:

    • Log in to your Shopify admin panel.
  2. Navigate to Online Store:

    • Click on "Online Store" in the left-hand menu.
    • Then click on "Themes."
  3. Edit Code:

    • Click on the "Actions" button next to your current theme and select "Edit Code."
  4. Update JavaScript Code:

    • In the "Layout" section, find and open the theme.liquid file.
    • Scroll to the bottom of the file, just before the closing </body> tag.
    • Replace the previous script with the updated one provided above.
  5. Save the Changes:

    • Click the "Save" button at the top right to save your changes.

This script uses a MutationObserver to watch for changes in the pagination container and reattaches the scroll-to-top behavior dynamically whenever the pagination links are updated.