How can I set up anchor links and smooth scrolling on my website?

How can I set up anchor links and smooth scrolling on my website?

dekiv
Shopify Partner
163 2 13

I am trying to create a more interactive website by having most content on the one page. When a user clicks on the service offered, to scroll down to that specific section. I have been reading about anchor links and smooth scrolling but still am quite lost as to how to set this up.

 

URL: https://simple-marketing-au.myshopify.com/?_ab=0&_bt=eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaEpJaVp6YVcxd2J...

 

Pass: theush

 

I am trying to make it so that when they click on a service it scrolls down to that section. Currently using columns section for the services and rich text for the sections I want it scrolled too. 

 

Want these sections so when clicked, scrolls down to their relevant information:

dekiv_0-1676533750305.png

 

 

Hoping someone call help me

Replies 2 (2)

GemPages
Shopify Partner
5625 1262 1279

Hello @dekiv

It's GemPages support team and glad to support you today.

 

Q1: To get anchor link to section, Please right click -> choose Inspect

GemPages_1-1676535929773.png

 

Copy Id section want to scroll to

GemPages_0-1676535882974.png

Paste Id section to here (add # character on start of Id section)

GemPages_2-1676536179359.png

 

Q2: To make smooth scroll, Please go to Online Store -> Theme -> Edit code

GemPages_3-1676536405700.png

 

Open your theme.liquid file, paste the below code before </body>

 

<style>
  html{
    scroll-behavior: smooth;
  }
</style>

 

I hope the above is useful to you.


Kind & Best regards, 
GemPages Support Team

GemPages - Build any high-converting store pages for any business


- If you find my reply helpful, please hit Like and Mark as Solution
- Get connected: App Store | Blog | Community | Help Center
dekiv
Shopify Partner
163 2 13

@GemPages Thank you so much for showing me that! It definitely works.

 

But how do I make it so that when it scrolls to that section, only that section is shown and not any other section? As you can see from screenshot, when I click on it, the "Social Media" section is visible below it:

dekiv_0-1676894552927.png