Jump to content

[Share] Click Text - Show More text on Right

Recommended Posts

Suppose you have 3 texts on the left and 3 other texts on the right.

And you want: when clicking on the Text, another Text will appear (screenshot).

  • If you can't make it work, you can share page url + exact code you added, I can help easier

image.thumb.png.43221d6efbbdda998419653c8d38aa85.png

#1. First, add 1 Text Block (with 3 texts: Apply, Google, Microsoft) on the left and 3 Text Blocks on the right.

Here I use random text, you can change to your desired text.

image.thumb.png.43221d6efbbdda998419653c8d38aa85.png

#2. Highlight each Text Block, and add these URLs:

  • #apple
  • #google
  • #microsoft

and make sure the option “Open Link in New Tab” is disabled.

image.png.4866d11da5f396504b6a10721978a779.png

image.png.6616ae4b1ff4cba084de0c5248e484ad.png

image.png.4c3886b6d1723da1c4058ec9c090840f.png

#3. Install Squarespace ID Finder to find the ID of Right Text Blocks

https://chromewebstore.google.com/detail/squarespace-id-finder/igjamfnifnkmecjidfbdipieoaeghcff

Or follow this 

 

We will have: Right Text Block

  • Apple text: #block-8f2d53134172e99fcccc
  • Google text: #block-7c4be9f29b167e39dc16
  • Microsoft text: #block-ea141edfec4623201a58
image.png.5cd066b1c6db1c8bf03ddd3904bf3345.png
#4. Use code to Code Injection – Footer (or Individual Page Header Injection)
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.7.0/jquery.min.js"></script>
<script>
$(document).ready(function(){
   $("#block-8f2d53134172e99fcccc").addClass("show");
  // Apple
  $('.html-block a[href="#apple"]').click(function(){
    $("#block-8f2d53134172e99fcccc").addClass("show");
$('div:not(#block-8f2d53134172e99fcccc)').removeClass('show');
    }
  );
// Google
 $('.html-block a[href="#google"]').click(function(){
    $("#block-7c4be9f29b167e39dc16").addClass("show");
$('div:not(#block-7c4be9f29b167e39dc16)').removeClass('show');
    }
  );
  // Microsoft 
   $('.html-block a[href="#microsoft"]').click(function(){
    $("#block-ea141edfec4623201a58").addClass("show");
$('div:not(#block-ea141edfec4623201a58)').removeClass('show');
    }
  );
});
</script>
<style>
#block-8f2d53134172e99fcccc, #block-7c4be9f29b167e39dc16, #block-ea141edfec4623201a58 {
  opacity: 0;
  transition: all 0.1s ease;
  }
  .show {
  opacity: 1 !important;
     transition: all 0.1s ease;
  }
</style>

image.png.c09fb6ca232f754b01074d73c76482b9.png

#5. Explain code

image.png.26a35ab8e29f2a42b8cd5a0893afc490.png

 

Email me if you have need any help (free, of course.). Answer within 24 hours. 
Or send to forum message

Contact Customer Care - Learn CSS - Buy me a coffee (thank you!)

Link to comment
  • Replies 0
  • Views 528
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Posted Images

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.