Jump to content

Add text to centre of screen when hovering over image blocks

Recommended Posts

Hi there,

I'm looking for way to add text when I hover over images on my site. I've found a way to add the text over the individual blocks, but I'm looking for a way to have the text appear large and in the centre of the screen (please see attached image to demonstrate what I mean)

Any help would be much appreciated! 

Thanks! 

http://www.timjobling.co.ukTJ_TEXT_HOVERcopy.thumb.jpg.3e5729db7641995fe60a100dd2c5cb07.jpg

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

Top Posters In This Topic

Top Posters In This Topic

Posted Images

6 hours ago, timjphoto said:

Hi there,

I'm looking for way to add text when I hover over images on my site. I've found a way to add the text over the individual blocks, but I'm looking for a way to have the text appear large and in the centre of the screen (please see attached image to demonstrate what I mean)

Any help would be much appreciated! 

Thanks! 

http://www.timjobling.co.ukTJ_TEXT_HOVERcopy.thumb.jpg.3e5729db7641995fe60a100dd2c5cb07.jpg

You can try the following Custom Css

/*set each text for image block hovered*/
body:has(#block-yui_3_17_2_1_1647613312964_40288:hover, #block-yui_3_17_2_1_1647613312964_254914:hover, #block-yui_3_17_2_1_1647613312964_73692:hover, #block-yui_3_17_2_1_1647613312964_51836:hover)::after {
  content: 'Carter Road Skatepark';
  opacity: 1;
  transition: opacity 0.5s ease;
}

/*General style*/
body::after {
  content:'';
  position: fixed;
  top: 50%;
  left: 50%;
  font-size: 40px;
  transform: translate(-50%,-50%);
  font-weight: bold;
  opacity: 0;
}

My testing

image.thumb.png.b7541bd9d6a82b3584af9fe518e4ba84.png

Let me know how it works on your site

BeyondSpace - Squarespace Website Developer

🖼️ Lightbox Studio (Enable Pinch/Zoom on lightbox)
🗓️ Delivery Date Picker (Squarespace Date picker form field)
💫 Gallery block 7.1 workaround
🥳 Sparkplugin Customisations Browsers (Browse +100 Spark plugin customisations)
🥳 Elfsight Template Browsers (Browse +1000 Elfsight widget Templates)

If you find my answer useful, let's leave a like or upvote so others with the same issue can find their solution. Thank you!

 

Link to comment

Hi @Beyondspace, thanks so much for your reply!

That code works amazingly and does what I was after, however I've run in to a couple of problems, firstly when the screen size is reduced the text overlaps and becomes jumbled, is there a way allow the text to resize automatically to fit the screen-size? The second is I'd love the text to be larger, but when you take it over around 65px the same issue happens with the jumbling of the text. I've attached an image so you can see what I mean.

Thanks so much again for your help, very much appricaited.

Screenshot 2024-05-10 at 19.59.44.png

Link to comment
6 hours ago, timjphoto said:

Hi @Beyondspace, thanks so much for your reply!

That code works amazingly and does what I was after, however I've run in to a couple of problems, firstly when the screen size is reduced the text overlaps and becomes jumbled, is there a way allow the text to resize automatically to fit the screen-size? The second is I'd love the text to be larger, but when you take it over around 65px the same issue happens with the jumbling of the text. I've attached an image so you can see what I mean.

Thanks so much again for your help, very much appricaited.

Screenshot 2024-05-10 at 19.59.44.png

Have you added the code yet? I can not see the code on my end

BeyondSpace - Squarespace Website Developer

🖼️ Lightbox Studio (Enable Pinch/Zoom on lightbox)
🗓️ Delivery Date Picker (Squarespace Date picker form field)
💫 Gallery block 7.1 workaround
🥳 Sparkplugin Customisations Browsers (Browse +100 Spark plugin customisations)
🥳 Elfsight Template Browsers (Browse +1000 Elfsight widget Templates)

If you find my answer useful, let's leave a like or upvote so others with the same issue can find their solution. Thank you!

 

Link to comment

I've just added back in but I'm excluding it from media screen max width 1000px as that's when the overlapping issue occurs. I would still love the text to be larger and to resize automatically as it would definitely look better but it's working really well so far. 

Thanks for the help!

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.