0

So I've spent a day on Google, and trying bits of jquery/javascript to do what I'm looking to do and am officially stuck.

I'm building a site using Squarespace, with the Marquee theme applied. I would like to be able to add a custom link in the primary navigation to send users to an alternative language version of each specific page.

But, I'm struggling. Ive found solutions on here that should work, but I don't think I'm applying it right. Ive tried adding a single link to the navigation and using a script on each page (in the code injection point of the head section) point that link somewhere else.

This would mean I have a single link in the navigation (which is standard across the site) pointing users to whichever page I want...on a per page basis. I know there is a solution out there....just can't make it work!

The section I need the link to work from is:

<div id="desktopNav" data-content-field="navigation-mainNav" data-annotation-alignment="bottom left">
<nav class="main-nav" id="yui_3_17_2_1_1450478013910_660">
<div class="nav-wrapper" id="yui_3_17_2_1_1450478013910_659">
<ul class="cf" id="yui_3_17_2_1_1450478013910_658">
<li class="page-collection">
<a href="/menu-marquee/"><span>Menu</span></a>
</li>
</ul>
</div>
</nav>
</div>

None of this can be edited directly though...

I was thinking something like this could work, but I cant work out how to apply it to my situation... Change href value for a hyperlink

Any help, gratefully received!

Community
  • 1
  • 1
Robo1985
  • 13
  • 5

1 Answers1

0

I fixed it...using this:

<script src="//ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>

  <script type="text/javascript">
$(document).ready(function(){
$('a[href*="original.site"]').attr('href',  'http://website.com');   
    });
    </script>

It allows me to point a single link in the navigation (which cant be edited directly) to whatever I want it to go to.

Robo1985
  • 13
  • 5