Demo: https://tuanphan-demo01.squarespace.com/click-image-show-text-on-right?noredirect
Password: abc
Suppose you have 3 image blocks on the left and 3 texts on the right
And you want: when clicking on the Image, a Text will appear.
You can follow these steps:
#1. First, add 3 Image Blocks on the left and 3 Text Blocks on the right
#2. Install Squarespace ID Finder to find the ID of Buttons and Newsletters.
In my example, we will have:
Left Image ID:
- Apple: #block-yui_3_17_2_1_1710206108509_28611
- Google: #block-yui_3_17_2_1_1710206108509_29086
- Microsoft: #block-yui_3_17_2_1_1710206108509_29548
Right Text ID:
- Apple: #block-yui_3_17_2_1_1710206108509_30858
- Google: #block-yui_3_17_2_1_1710206108509_32691
- Microsoft: #block-yui_3_17_2_1_1710206108509_34456
#3. Use code to Code Injection – Footer (or Page Header Code Injection)
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.7.0/jquery.min.js"></script> <script> $(document).ready(function(){ // Apple $('#block-yui_3_17_2_1_1710206108509_28611').click(function(){ $("#block-yui_3_17_2_1_1710206108509_30858").addClass("show"); $('div:not(#block-yui_3_17_2_1_1710206108509_30858)').removeClass('show'); } ); // Google $('#block-yui_3_17_2_1_1710206108509_29086').click(function(){ $("#block-yui_3_17_2_1_1710206108509_32691").addClass("show"); $('div:not(#block-yui_3_17_2_1_1710206108509_32691)').removeClass('show'); } ); // Microsoft $('#block-yui_3_17_2_1_1710206108509_29548').click(function(){ $("#block-yui_3_17_2_1_1710206108509_34456").addClass("show"); $('div:not(#block-yui_3_17_2_1_1710206108509_34456)').removeClass('show'); } ); }); </script> <style> #block-yui_3_17_2_1_1710206108509_30858, #block-yui_3_17_2_1_1710206108509_32691, #block-yui_3_17_2_1_1710206108509_34456 { opacity: 0; transition: all 0.1s ease; } .show { opacity: 1 !important; transition: all 0.1s ease; } </style>
#4. Explain code