HenryDaeche Posted December 19, 2020 Share Posted December 19, 2020 Site URL: https://www.twfcorfu.com/ Hello, I'd like to add a clickthrough link to the title of a navigation folder. https://www.twfcorfu.com/ For the first 'Accommodation' folder, I'd like the navigation title to go to this page - https://www.twfcorfu.com/accommodation The website is on the Five template. Thanks. Link to comment
creedon Posted December 19, 2020 Share Posted December 19, 2020 You will need to be on the business plan or above to implement this solution. Add the following to Settings > Advanced > Code Injection > HEADER. <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script> Add the following to Settings > Advanced > Code Injection > FOOTER. <script> $( ( ) => { $( '#main-navigation .folder-collection:first a:first' ) .removeAttr ( 'onclick' ) .attr ( 'href', '/accommodation' ); } ); $( '#main-navigation .folder-collection:nth-of-type(2) a:first' ) .removeAttr ( 'onclick' ) .attr ( 'href', '/resorts-choose' ); } ); </script> This is for a v7.0 using the Five template. Let us know how it goes. Find my contributions useful? Please like, upvote, mark my answer as the best ( solution ), and see my profile. Thanks for your support! I am a Squarespace ( and other technological things ) consultant open for new projects. Link to comment
HenryDaeche Posted December 20, 2020 Author Share Posted December 20, 2020 On 9/28/2020 at 1:38 AM, tuanphan said: Yes. Possible. Can you share link to page where you use Stack images? We can check easier. That's great thank you. It works for accommodation. How can I change the code to work with the next navigation title, I want it to go to a page with the URL slug /resorts-choose? Thanks. Link to comment
creedon Posted December 20, 2020 Share Posted December 20, 2020 I have updated my previous answer. Find my contributions useful? Please like, upvote, mark my answer as the best ( solution ), and see my profile. Thanks for your support! I am a Squarespace ( and other technological things ) consultant open for new projects. Link to comment
HenryDaeche Posted December 31, 2020 Author Share Posted December 31, 2020 On 12/20/2020 at 10:18 PM, creedon said: I have updated my previous answer. That didn't work, it also broke the first Accommodation navigation title too. Link to comment
HenryDaeche Posted December 31, 2020 Author Share Posted December 31, 2020 2 minutes ago, whoshenry said: That didn't work, it also broke the first Accommodation navigation title too. I fixed it by removing the spaces either side of the number 2. Thanks for your help! Link to comment
katie2203 Posted January 4, 2021 Share Posted January 4, 2021 Hello there! I'm having a problem with this too on my site. It's not live yet, but i'm trying to do the same as above but its not working for me. I've created a folder which i'd like to be called Directory and would like it to point to my /directory page. Would you please be able to help. I'm using the Artesia template. Many thanks in advance! Link to comment
creedon Posted January 5, 2021 Share Posted January 5, 2021 @katie2203 Please post the URL to your site. Please set up a site-wide password, if you've not already done so. Post the password here. We can then take a look at your issue. Find my contributions useful? Please like, upvote, mark my answer as the best ( solution ), and see my profile. Thanks for your support! I am a Squarespace ( and other technological things ) consultant open for new projects. Link to comment
katie2203 Posted January 5, 2021 Share Posted January 5, 2021 Hello @creedon! Thank you for your response. The URL is stalbans.thewearecommunity.co.uk password is help2021 and id like to make clicking on "directory" take you to the directory which is in the dropdown below it. So all you see is Directory on the title and Join Us below it as a dropdown. Any help would be great! Many thanks in advance! Katie Link to comment
tuanphan Posted January 6, 2021 Share Posted January 6, 2021 On 1/5/2021 at 7:14 PM, katie2203 said: Hello @creedon! Thank you for your response. The URL is stalbans.thewearecommunity.co.uk password is help2021 and id like to make clicking on "directory" take you to the directory which is in the dropdown below it. So all you see is Directory on the title and Join Us below it as a dropdown. Any help would be great! Many thanks in advance! Katie Add to Code Injection Footer <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.0/jquery.min.js"></script> <script> $(document).ready(function() { $(".nav-item.folder:nth-child(3)").click(function() { var link = $(this).text(), href = "https://google.com"; 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 Contact Customer Care - Learn CSS - Buy me a coffee (thank you!) Link to comment
sibs Posted January 25, 2021 Share Posted January 25, 2021 @creedon Can you help me do that same for my site? the url is https://www.designstandstogether.com/ and I would like each of the navigation titles to go to the top of the page the rest of the drop down link to. For example, When you click on BeWell, I would like it to go to https://www.designstandstogether.com/bewell/ Link to comment
creedon Posted January 26, 2021 Share Posted January 26, 2021 @sibs You will need to be on the business plan or above to implement this solution. Add the following to Settings > Advanced > Code Injection > HEADER. <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script> Add the following to Settings > Advanced > Code Injection > FOOTER. <script> $( ( ) => { // change navigation folder URL Slugs for v7.1 site const folderPositionUrlMappings = { /* the format of each line is the position of the folder in the navigation and the replacement URL Slug for the folder. */ // '[enter position here]' : '[enter url here]', '1' : '/bewell', '2' : '/diversityindesign', '3' : '/begreen', '4' : '/events-full-page' // last or only item doesn't get a comma } // do not change anything below, there be the borg here const keys = Object.keys ( folderPositionUrlMappings ); $.each ( keys, function ( i, key ) { $( '.header-nav-item--folder:nth-child(' + key + ') a:first' ) .attr ( 'href', folderPositionUrlMappings [ key ] ); } ); } ); </script> This is for a v7.1. Let us know how it goes. Find my contributions useful? Please like, upvote, mark my answer as the best ( solution ), and see my profile. Thanks for your support! I am a Squarespace ( and other technological things ) consultant open for new projects. Link to comment
SourMonkey Posted February 5, 2021 Share Posted February 5, 2021 @creedon @tuanphan I am having the same issue on my website (not published yet). I am trying to make the folder name link to a different page on the site. I'm using 7.1. Anyone have advice? Link to comment
creedon Posted February 5, 2021 Share Posted February 5, 2021 @SourMonkey Please post the URL for your site. If your site is not public please set up a site-wide password, if you've not already done so. Post the password here. We can then take a look at your issue. Find my contributions useful? Please like, upvote, mark my answer as the best ( solution ), and see my profile. Thanks for your support! I am a Squarespace ( and other technological things ) consultant open for new projects. Link to comment
Recommended Posts
Archived
This topic is now archived and is closed to further replies.