Jump to content

Customize Index Navigation in York Template

Recommended Posts

Posted

Site URL: http://www.chirp-design.com

I am using the York Template for a portfolio site. When you click on an index thumbnail to open up a project page and scroll to the bottom, the index navigation is setup to read "NEXT" (which takes the user to the next project in the index).

I love this feature, but would also like to include a "PREVIOUS" or "BACK" option as well so that users can navigate forward and backward through the index of projects. My site is not live yet, but here is a screenshot of the index navigation as it currently appears (just above the page footer).

Does anyone know how to incorporate custom code to the index navigation so that it can move backward as well?

Screen Shot 2020-06-25 at 4.27.07 PM.png

  • Replies 24
  • Views 1.1k
  • Created
  • Last Reply
Posted

Sorry, it's within the pages... Example below ...

Here is the Centered "NEXT" button

I want to justify it left, like everything else, and if possible, add the previous button...

image.thumb.png.7996f3e950b3c7d692e36174d884ef4f.png

Posted

@GregHerman I am grasping at straws here with the prev button.......but......  give this a try:

Here's some CSS that we need to add:

nav.index-next {
    display: inline-flex !important;
    margin-top: auto !important;
}

.index-next .link-next-up {
    padding-right: 25px;
}

And some jQuery

$(document).ready(function() {
  var NextLink = $('a.active-link')
  var PrevLink = $(NextLink).prev('a')
  var PrevSpan = $(PrevLink).children('span').first()
  $(PrevLink).attr('class', 'index-next-link page-collection index-page-transition-link link-next-up');
  $(PrevSpan).attr('data-next-link', 'PREV');
})

 

Posted

@rwp Thanks for the effort, but it's not working..

I added the 1st part to the css custom section and the next part to the head of the code injection section under advanced. I assumed that is where jQuery should live.. I saw a lot of text at the top of the pages, if that is any clue?

Wish I could be of more help, but I really appreciate you and your efforts.

Thanks again!!!

Posted
1 hour ago, GregHerman said:

@rwp Thanks for the effort, but it's not working..

I added the 1st part to the css custom section and the next part to the head of the code injection section under advanced. I assumed that is where jQuery should live.. I saw a lot of text at the top of the pages, if that is any clue?

Wish I could be of more help, but I really appreciate you and your efforts.

Thanks again!!!

You need to add the jQuery script, check my signature for instructions.

Posted

@rwp  THANK yOU AGAIN!!!  you are too kind and I sooo appreciate your efforts..

Unfortunately I'm still struggling with getting this to work.

I added the Jquery code

<script src="https://code.jquery.com/jquery-3.5.1.min.js" integrity="sha256-9/aliU8dGd2tb6OSsuzixeV4y/faTqgFtohetphbbj0=" crossorigin="anonymous"></script>

to the code injection .. 

And added <Script></script> tags to your jquery code. 

I've got your css in the custom css section and both the jquery codes in the advanced site wide injection.

Wish I could say it worked....Again, Thank you the effort... you rock.

Posted
window.Squarespace.onInitialize(Y, function () {
  var NextLink = $('a.active-link');
  var PrevLink = $(NextLink).prev('a');
  var PrevSpan = $(PrevLink).children('span').first();
  $(PrevLink).attr('class', 'index-next-link page-collection index-page-transition-link link-next-up');
  $(PrevSpan).attr('data-next-link', 'PREV');
});

Try replacing the block of code with this one. The ajax loading is causing the issue.

Posted

BOOM!

That worked! DUDE Thank you so much.. I cant thank you enough for our efforts.. 

you are a coding badass, mad respect.  I owe u one. 

Thanks again Ryan

 

 

Posted

@AbbyGoodson I just check really quickly, it looks the the code above will work for you too, let me know if it doesn't work right.

See my signature for how to use this code.

 Here's some CSS that we need to add:

nav.index-next {
    display: inline-flex !important;
    margin-top: auto !important;
}

.index-next .link-next-up {
    padding-right: 25px;
}

And some jQuery

window.Squarespace.onInitialize(Y, function () {
  var NextLink = $('a.active-link');
  var PrevLink = $(NextLink).prev('a');
  var PrevSpan = $(PrevLink).children('span').first();
  $(PrevLink).attr('class', 'index-next-link page-collection index-page-transition-link link-next-up');
  $(PrevSpan).attr('data-next-link', 'PREV');
});

 

Posted

Thanks @rwp!

It looks like this code worked, just needs a little design finessing. Are any of the below options possible?

  • Can "PREV" text say "BACK" instead?
  • Can it be centered instead of left aligned?
  • Can some padding be added above the "PREV NEXT" text? 
Posted

Figured it out...... Change the code to this

nav.index-next {
    display: inline-flex !important;
	width: max-content;
}

.index-next .link-next-up {
    margin: auto;
    padding-left: 20px;
    padding-right: 20px;
}

 

Archived

This topic is now archived and is closed to further replies.

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