Jump to content

How to make a 'Folder' in site header/navigation link to a page

Recommended Posts

Posted

Site URL: https://thedigitalgrowth.co

Hi there,

Currently, the folders within my site navigation don't direct anywhere when clicked. They currently act as just a field to hover, and select a page from the dropdown.

I would like to create a page, hidden from navigation, that this topline folder could point to when clicked. I don't want it to link to the first page in the dropdown, I'd rather create a page that users can be directed to once they click the topline folder.

How can this be implemented? (See attached, I'm referring to the section underlined in Red)

Thanks in advance!

Site-Folder-In-Nav.png

Posted

Add to Settings > Advanced > Code Injection > Footer

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script>
$(document).ready(function() { 
		$('a.header-nav-folder-title[href="/our-services"]').click(function() {
			var link = $(this).text(),
				href = "https://google.com";
			window.location.href=href;
		});
  		$('a.header-nav-folder-title[href="/case-studies"]').click(function() {
			var link = $(this).text(),
				href = "https://google.com";
			window.location.href=href;
		});
});
</script>

Replace google with new url

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!)

Posted
15 hours ago, tuanphan said:

Add to Settings > Advanced > Code Injection > Footer

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script>
$(document).ready(function() { 
		$('a.header-nav-folder-title[href="/our-services"]').click(function() {
			var link = $(this).text(),
				href = "https://google.com";
			window.location.href=href;
		});
  		$('a.header-nav-folder-title[href="/case-studies"]').click(function() {
			var link = $(this).text(),
				href = "https://google.com";
			window.location.href=href;
		});
});
</script>

Replace google with new url

Thank you, this is fantastic! Appreciate the help so much.

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.