Jump to content

How to put text on second line of Grid Overlay hover that's different on specified pages?

Go to solution Solved by Lesum,

Recommended Posts

My client wants his portfolio to have hover titles which show the client on one line and the director on a second line. I've customized the text size and figured out how to make it look the way he wants in css. He has multiple portfolio categories (commercial, work, shorts) and I know they are all linked but I thought using the page or section ID to add the directors individually for each page would work. Unfortunately, it hasn't and the same directors end up being repeated on all the portfolio pages (which is incorrect). 

How can I make this work?

Here is the current code I've got in there for Commercial (but it's showing the directors for Automotive):
 

.portfolio-title:after{
 white-space:pre; 
 content:"\A Second Line";
 text-transform:uppercase;
 font-size: 1.5rem 
}
#collection-669afebe90bae63ebf312da9 {

.target-here {

.grid-item:nth-of-type(1) .portfolio-title:after{ white-space:pre; content:"\A JOANN LEMOINE" }

.grid-item:nth-of-type(2) .portfolio-title:after{ white-space:pre; content:"\A Dave Laden" }

     etc. etc. for each director...

 

Can this be done? Hellllp!

Screen Shot 2024-08-06 at 11.59.45 AM.png

Link to comment
  • Replies 5
  • Views 682
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Posted (edited)

@Lesum I included the site url when I created this. I didn't realize it wouldn't include it. 

Here it is.

Maybe I didn't explain it right...?

Each portfolio has different categories of video work, and thumbnails are featured in the Grid Overlay Portfolio. I added a dark hover and the titles of the videos appear in white. He wanted the director of the piece to be on a second line in smaller text. I accomplished this by putting each director's name in css (see code above). I tested it on the "Commercial" category. It looked perfect!

The problem happened when I went to the second category ("Automotive") and put css in, because the directors then appeared the same for the videos on Commercial and Automotive. So I tried to call out each specific page to say "These directors only appear on this page" basically. I thought it would work and it did not.

I need the directors to be correct for each video.

ALSO... I now realize the css does not work on the mobile view and the directors aren't showing up at all.

Does that make more sense???

Edited by Lynnster
Forgot to reply to a specific person.
Link to comment
  • Solution

Instead of using an nth-of-type selector that targets all portfolio items, you need to target each portfolio item based on its URL.

  1. First, add your Director name in the content: "Director name" section of the code. 

  2. Next, go to your portfolio folder in the Squarespace editor. For the individual project where you want to add the director name, navigate to Settings > URL Slug and copy the entire text under URL Slug. For the first project in the second category ("Automotive"), it might look like this: /auto/lincoln-uncharted-waters

  3. Replace href="/category-name/project-name" in the code with the copied URL slug from step 2.

Refer to the screenshots:

Here's the code you need to add under Website > Pages > Website Tools > Custom CSS. This will display a director name for the specified project on your site.

.portfolio-title:after {
    display: block;
}

a.grid-item[href="/category-name/project-name"] .portfolio-title:after {
    content: "Director name";
}

For the first project in the second category ('Automotive'), the code should look like the following. This block of code needs to be added for each project, changing the URL and directory name text in the content: section accordingly.

a.grid-item[href="/auto/lincoln-uncharted-waters"] .portfolio-title:after {
    content: "Director name";
}

 

Screenshot portfolio.png

Screenshot portfolio 1.png

If my comments were useful, please like or mark my solution as answer so others can scroll to it quickly. 

Sam
Web Developer & Digital Designer

 Did you find my contribution helpful? Buy me a coffee?

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.