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
  • Views 460
  • 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?

BeyondSpace - Squarespace Website Developer

🖼️ Lightbox Studio (Enable Pinch/Zoom on lightbox)
🗓️ Delivery Date Picker (Squarespace Date picker form field)
💫 Gallery block 7.1 workaround
🥳 Sparkplugin Customisations Browsers (Browse +100 Spark plugin customisations)
🥳 Elfsight Template Browsers (Browse +1000 Elfsight widget Templates)

If you find my answer useful, 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

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

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.