Jump to content

Navigation Bar coding

Recommended Posts

Site URL: http://nickpiper.tv

I have three options for users to click in my navigation bar.

FILMS    ABOUT    PEOPLE

There is a secondary drop down menu under the PEOPLE link that reveals three options for users to click on:

PEOPLE

EFFECTS

CARS

When users click on these links is there a way to make the navigation bar update to show the title of the drop down menu page, so for example if a user selects EFFECTS, then the navigation bar updates to:

FILMS   ABOUT   EFFECTS

I understand this will require some unsupported code editing, but I'm hoping someone has a clever trick they can share.

Thanks

Link to comment
  • Replies 1
  • Views 297
  • Created
  • Last Reply

You can insert this snippet in the FOOTER

Settings -> Advanced -> Code Injection
 

<script>
(function() {
	var matchedUrl = location.href.replace(location.origin, "")
    var linkItem = document.querySelector('.Header-nav-folder-item[href*="'+matchedUrl+'"]');

    if (linkItem) {
        linkItem.parentNode.previousElementSibling.innerText = linkItem.innerText;
    }
})();
</script>

 

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

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.