Jump to content

Make an entire text block including the background a clickable link

Recommended Posts

Basically, I am trying to make these text blocks into cards that all become clickable links to separate pages.

I can link the text, but i want to link the entire box so that you can click anywhere on the card on both mobile and desktop.

Any help would be great, thanks. 

Also, how could i then add hover effects such as changing the block colour and the text colour?

Screenshot 2024-08-04 at 19.05.58.png

Link to comment

@connorablaker Hi! You can add this code in Website > Pages > Website Tools > Code Injection > Header

<script src="https://code.jquery.com/jquery-3.7.0.min.js"></script>

<script>
  $(document).ready(function() {
  // Link about page
  $("#block-yui_3_17_2_1_1722789389685_3256").wrap('<a href="https://sketchedin.co.uk/about" target="_blank"></a>'); 
    
  // Link work page
  $("#block-yui_3_17_2_1_1722817017359_23166").wrap('<a href="https://sketchedin.co.uk/work" target="_blank"></a>');
  
  // Link process page
  $("#block-4a925654c1821ef1a6c6").wrap('<a href="https://sketchedin.co.uk/process" target="_blank"></a>');
  
  // Link contact page
  $("#block-7e3768cb5c808cf4dd23").wrap('<a href="https://sketchedin.co.uk/contact" target="_blank"></a>');
});
</script>

 

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.