Header Selected State

It would be great if the header could update based on the page you’re on to show the selected page, either by making the font more bold, or allowing for changing the color for a selected page, or doing an underline of some kind. This is a basic usability principle to help people know where they are on the site and would go a long way to making it more usable. Or at least allow for editing all link colors/styles for each link in the header. That way we can have a custom version of the header for each parent page in our site.

1 Like

Screen Shot 2022-05-14 at 9.30.12 AM

I realized we’re able to add buttons to the header and kind of create this format in the vertical header. Basically each ‘selected’ page just gets a button background color on each page. But the site tucks buttons to the bottom of the vertical nav which makes them unusable (see screenshot).

Is there any way to at least update the header so that if you’re using a vertical header without links in it (using buttons only), it pins buttons to the top of the nav?

We can figure something out to highlight a menu link currently being browsed.

Javascript to add active class to menu link containing href matching current url.

<script>
$(function(){
    var url = window.location.href; 
    $("#sub-header a").each(function() {
        if(url == (this.href)) { 
            $(this).closest("li").addClass("active");
        }
    });
});
</script>

CSS to style the active class as you want:

#sub-header .active a{ color: #fff; }

Can you give me a link to your site so I can adapt the above script to work with your page?

Thank you for this! Still building but here’s the homepage for now.
https://ft.softr.app/

Thoughts on how I could do this?

@Jeremy,

Added it as a feature request already :slight_smile:

1 Like