Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
Advanced Search
  • 0

Keep Main Navigation underlined when viewing a Not Linked Page



Site URL: https://pomegranate-badger-p3wd.squarespace.com/

Hi, I'm using 7.1.  I have five Main Navigation pages that are associated to pages that are in the Not Linked section of Squarespace. I'm trying to make it so when someone is viewing a Not Linked Page, the Main Navigation associated to that page remains underlined.

For example: so when someone is on Issue #1: Disrupt (Not Linked Page), Magazine (Main Navigation) is still underlined

How can you do this without using Folders?

@tuanphan, @bangank36, @creedon


Link to comment

2 answers to this question

Recommended Posts

  • 2

It may be possible to do this with CSS only but it seems to me it would be a more tortuous route. Javascript seems a better fit here.

Add the following to Settings > Advanced > Code Injection > HEADER. The OP doesn't need to do this step as they already have jQuery installed.

<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.


  $( ( ) => {
      begin add navigation magazine underline to magazine subpages
      Version       : 0.1d0
      SS Version    : 7.1
      Dependancies  : jQuery
      By            : Thomas Creedon < http://www.tomsWeb.consulting/ >
      no user serviceable parts below
      // bail if not magazine subpage
      if ( ! location.pathname.startsWith ( '/magazine/' ) ) return;
      $( '.header-nav-item [href="/magazine"]' )
        .parent ( )
        .addClass ( 'header-nav-item--active' );
      // end add navigation magazine underline to magazine subpages
    } );

Let us know how it goes.

Find my contributions useful? Please like, upvote, mark my answer as best , and see my profile. Thanks for your support!

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...