Demo: https://tuanphan3.squarespace.com/hover-text-show-card-1?noredirect
Pass: abc
#1. First, you add a Text Block on the left, with some text/url.
Make sure the option “Open link in new tab” is disabled
- Apple: #apple
- Instagram: #instagram
- Google: #google
and some cards (Text Block, Image Block, Button Block) on right
#2. Install Squarespace ID Finder and find the ID of all blocks
In my example, we will have:
Left Text Block: #block-674916187293b28bcf22
Instagram:
- Image: #block-yui_3_17_2_1_1710290716827_27948
- Text: #block-b45d3fcc1add69340d2b
- Button: #block-yui_3_17_2_1_1710290716827_30416
Apple:
- Image: #block-yui_3_17_2_1_1710290716827_29045
- Text: #block-0158d0d836a05d45f7e1
- Button: #block-yui_3_17_2_1_1710290716827_33690
Google:
- Image: #block-yui_3_17_2_1_1710290716827_29732
- Text: #block-e6917fc32b936ed6230d
- Button: #block-yui_3_17_2_1_1710290716827_35363
#3. Use this 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(){ // Instagram $('#block-674916187293b28bcf22 a[href="#instagram"]').hover(function(){ $("#block-yui_3_17_2_1_1710290716827_27948,#block-b45d3fcc1add69340d2b,#block-yui_3_17_2_1_1710290716827_30416").addClass("show"); $('div:not(#block-yui_3_17_2_1_1710290716827_27948):not(#block-b45d3fcc1add69340d2b):not(#block-yui_3_17_2_1_1710290716827_30416)').removeClass('show'); } ); // Apple $('#block-674916187293b28bcf22 a[href="#apple"]').hover(function(){ $("#block-yui_3_17_2_1_1710290716827_29045,#block-0158d0d836a05d45f7e1,#block-yui_3_17_2_1_1710290716827_33690").addClass("show"); $('div:not(#block-yui_3_17_2_1_1710290716827_29045):not(#block-0158d0d836a05d45f7e1):not(#block-yui_3_17_2_1_1710290716827_33690)').removeClass('show'); } ); // Google $('#block-674916187293b28bcf22 a[href="#google"]').hover(function(){ $("#block-yui_3_17_2_1_1710290716827_29732,#block-e6917fc32b936ed6230d,#block-yui_3_17_2_1_1710290716827_35363").addClass("show"); $('div:not(#block-yui_3_17_2_1_1710290716827_29732):not(#block-e6917fc32b936ed6230d):not(#block-yui_3_17_2_1_1710290716827_35363)').removeClass('show'); } ); }); </script> <style> /* hide cards initial */ /* instagram */ #block-yui_3_17_2_1_1710290716827_27948,#block-b45d3fcc1add69340d2b,#block-yui_3_17_2_1_1710290716827_30416 { opacity: 0; transition: all 0.1s ease; } /* apple */ #block-yui_3_17_2_1_1710290716827_29045,#block-0158d0d836a05d45f7e1,#block-yui_3_17_2_1_1710290716827_33690 { opacity: 0; transition: all 0.1s ease; } /* Google */ #block-yui_3_17_2_1_1710290716827_29732,#block-e6917fc32b936ed6230d,#block-yui_3_17_2_1_1710290716827_35363 { opacity: 0; transition: all 0.1s ease; } .show { opacity: 1 !important; transition: all 0.1s ease; } </style>
#4. Explain code