Jump to content

Harris - Anchor links on mobile

Recommended Posts

I have set up anchor links on a site using the Harris template and following Squarespace's direction to insert code to make anchor links work. I've included the home page slug and the anchor in my links. They work perfectly on desktop, but on mobile they don't go anywhere.

Anyone have a solution? Thanks!

Link to comment
  • Replies 6
  • Views 849
  • Created
  • Last Reply

Yeah I just noticed that too, they used to work fine on desktop but now they aren't anymore.

I followed this article - https://support.squarespace.com/hc/en-us/articles/207842357

So each of my page headers - "What We Do", "Who We Are", "Contact Us", have a code block applied to the h1 with for example

<h1 id="what-we-do">What We Do</h1>

and then in my navigation, I created links that link to /home/#what-we-do

Link to comment

@emorykole If site under 20 pages, you can use both, insert both on the Menu, then use CSS to hide a type of anchor when on these pages, and hide the other type of anchor when on another page.

The code will look like this


/* Anchor link: home */
.page-id1, .page-id2, .page-id3,... {
  .navigation-anchor-1 {display: none;}
}
/* Anchor link: no home */
.page-idx, .page-idy, .page-idz... {
 .navigation-anchor-2 {display: none;}
}

You can also use Main & Secondary Nav for two types of anchor links, so you'll need less CSS (if the template supports).

Email me if you have need any help (free, of course.). Answer within 24 hours. 
Or send to forum message

Contact Customer Care - Learn CSS - Buy me a coffee (thank you!)

Link to comment

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.