Jump to content

Foldername in Header stays highlighted when you go on sub pages

Recommended Posts

Try adding this to Last Line in 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#header a.active {
    border-bottom: 1px solid currentColor !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
On 11/9/2022 at 7:22 PM, kernholz said:

thank you very much for your reply! unfortunately it does not work somehow

Can you keep the code in Code Injection? We will check it again

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

ah okay

Try adding this code to all Stadtmobel sub Pages Header, if it works, I will give instruction for other folders

<style>
  div.header-nav-item:nth-child(1)>a {
    color: red !important;
}
  .header-menu-nav-folder[data-folder="root"]>div>div:nth-child(1)>a {
    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
6 minutes ago, kernholz said:

hey, somehow the Stadtmöbel becomes red but stays red the whole time

You mean change color of active page (eg if users on lamellenbaenke page, will change color of lamellenbaenke item), or change color of Folder Title? Above is Folder Title (eg if users on lamellenbaenke page, will change color of Stadtmöbel)?

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
On 11/12/2022 at 3:37 PM, tuanphan said:

ah okay

Try adding this code to all Stadtmobel sub Pages Header, if it works, I will give instruction for other folders

<style>
  div.header-nav-item:nth-child(1)>a {
    color: red !important;
}
  .header-menu-nav-folder[data-folder="root"]>div>div:nth-child(1)>a {
    color: red !important;
}
</style>

 

Have you tried this code for First Folder yet? I just tested it again & it seems work

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
  • 3 weeks later...

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.