Jump to content

Linking a folder title in navigation

Go to solution Solved by tuanphan,

Recommended Posts

Posted (edited)

I am attempting to make the folder title WHATS ON in my website clickable by inserting a link to the VIEW ALL EVENTS page shown in the WHATS ON drop down menu. I have injected the code below into the website but the what's on title is still not clickable.

 

Header

 

<script src=https://code.jquery.com/jquery-3.6.0.min.js></script>

 

Footer

 

<script>

  $(".header-nav-folder-title[href='/WHATS-ON']").click(function() {

     window.location.href = "/live-events";

  });

</script>

 

URL is www.gloucesterguildhall.co.uk. This website uses 7.0.

 

Is anyone able to advise regarding if this is the correct code to use?

 

Edited by Sam999
Link to comment
  • Replies 9
  • Created
  • Last Reply

Top Posters In This Topic

Add to Settings > Advanced > Code Injection > Footer

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.3/jquery.min.js"></script>
<script>
  $(document).ready(function() { 
		$("nav.main-nav>ul>li:nth-child(2)>a").click(function() {
			var link = $(this).text(),
				href = "/live-events";
			window.location.href=href;
		});
});
</script>

 

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
13 hours ago, tuanphan said:

Add to Settings > Advanced > Code Injection > Footer

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.3/jquery.min.js"></script>
<script>
  $(document).ready(function() { 
		$("nav.main-nav>ul>li:nth-child(2)>a").click(function() {
			var link = $(this).text(),
				href = "/live-events";
			window.location.href=href;
		});
});
</script>

 

Thank you. Can you advise if it would be the same code block that I would use if I wanted to also add a link to another folder title on the website?

I would like to also add a link to the folder title HIRE US with an unlisted page that has the URL slug /HIRES.

 

Link to comment
On 5/15/2023 at 2:31 AM, Sam999 said:

Thank you. Can you advise if it would be the same code block that I would use if I wanted to also add a link to another folder title on the website?

I would like to also add a link to the folder title HIRE US with an unlisted page that has the URL slug /HIRES.

 

Can you add Hire Us folder first? We can check code easier

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
  • Solution
On 5/15/2023 at 2:31 AM, Sam999 said:

Thank you. Can you advise if it would be the same code block that I would use if I wanted to also add a link to another folder title on the website?

I would like to also add a link to the folder title HIRE US with an unlisted page that has the URL slug /HIRES.

 

Use this new code

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.3/jquery.min.js"></script>
<script>
  $(document).ready(function() { 
		$("nav.main-nav>ul>li:nth-child(2)>a").click(function() {
			var link = $(this).text(),
				href = "/live-events";
			window.location.href=href;
		});
    $("nav.main-nav>ul>li:nth-child(3)>a").click(function() {
			var link = $(this).text(),
				href = "/corporate-hire";
			window.location.href=href;
		});
});
</script>

 

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 5/12/2023 at 12:26 AM, ltaborsky said:

I would also like to know how to make a folder link to a page.

www,hydrometrics.com

Thank you.

Sorry, I didn't see your comment. Add this to Settings > Advanced > Code Injection > Footer

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.3/jquery.min.js"></script>
<script>
  $(document).ready(function() { 
		$('a.header-nav-folder-title[href="/whatwedo"]').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

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

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.