Jump to content

Need with with changing the color active nav links

Recommended Posts

Its a single page website. Here I wish to change the color of the active section on the navigation. I have added the following code but this only seems to work on force state over the link.

.header-nav-item a:active {
  1. color: #fc9e4f !important;
}
Tired this one as well
body:not(.header--menu-open) .header-nav-wrapper 
a:active {
  1. color: #fc9e4f !important;
}

Let me know  if anyone knows other ways to make this happen. Thanks team 

Link to comment
  • Replies 3
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

57 minutes ago, bhavanaidnani said:

Its a single page website. Here I wish to change the color of the active section on the navigation. I have added the following code but this only seems to work on force state over the link.

.header-nav-item a:active {
  1. color: #fc9e4f !important;
}
Tired this one as well
body:not(.header--menu-open) .header-nav-wrapper 
a:active {
  1. color: #fc9e4f !important;
}

Let me know  if anyone knows other ways to make this happen. Thanks team 

Can you share your site with the protected password so we can take a look?

Greeting, it's BeyondSpace, I am Squarespace dev focus on provide solutions to enhance feature that squarespace.com can't provide.
Feel free to check my current Squarespace Plugins Developement: Enable Pinch/Zoom on lightbox, Delivery Date Picker, Keyword Highlighter
If you find my answer fit your need, let's leave a like or upvote so others with the same issue can find their solution. Thank you

Link to comment

@bhavanaidnani Add to Settings > Advanced > code Injection > Footer

<script>
var btnContainer = document.getElementById("header");
var btns = btnContainer.getElementsByTagName("a");
for (var i = 0; i < btns.length; i++) {
  btns[i].addEventListener("click", function() {
    var current = document.getElementsByClassName("active");
    if (current.length > 0) {
      current[0].className = current[0].className.replace(" active", "");
    }
    this.className += " active";
  });
}
</script>
<style>
  .header-nav-item a.active {
   color: red !important;
}
</style>

 

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

How to: Setup Password & Share url Insert Custom CSS - Page Header - Upload Custom Font - Upload File - Find Block ID - Contact Customer Care

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

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