Demo: https://tuanphan-demo01.squarespace.com/hover-text-show-more-text?noredirect
Password: abc
Suppose you have 5 texts: Apple, Microsoft, Facebook, Instagram, and Google.
You want: when users hover on each text > show more text on the right side, something like this.
#1. First, add a Text Block with 5 Paragraph, then add these URLs
- Apple – #apple
- Microsoft – #microsoft
- Facebook – #facebook
- Instagram – #instagram
- Google – #google
and make sure the option “Open Link in new tab” is DISABLED.
(if you want to remove the Link Underline, I will provide the code in step #4)
#2. Add 5 Text Blocks on the right side (You can drag them to make them overlap together then, or keep the current position if you want).
#3. Install Squarespace ID Finder tool (Free)
Then, you can find the ID of the Left Text Block and 5 Text Blocks on the right with the tool. In this example, we will have:
- Apple: #block-yui_3_17_2_1_1709172012907_25285
- Microsoft: #block-yui_3_17_2_1_1709172012907_26049
- Facebook: #block-yui_3_17_2_1_1709172012907_27013
- Instagram: #block-yui_3_17_2_1_1709172012907_28082
- Google: div#block-yui_3_17_2_1_1709172012907_29250
#4. Use this code to Code Injection – Footer or Page Header Code Injection (the page where you added 6 Text Blocks)
<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_1709172012907_25285").closest('.fe-block').addClass('apple show'); $('a[href="#apple"]').addClass('active-link'); // Microsoft $("#block-yui_3_17_2_1_1709172012907_26049").closest('.fe-block').addClass('microsoft'); // Facebook $("#block-yui_3_17_2_1_1709172012907_27013").closest('.fe-block').addClass('facebook'); // Instagram $("#block-yui_3_17_2_1_1709172012907_28082").closest('.fe-block').addClass('instagram'); // Google $("div#block-yui_3_17_2_1_1709172012907_29250").closest('.fe-block').addClass('google'); // Apple $('a[href="#apple"]').hover(function(){ $(".apple").addClass("show"); $('.fe-block:not(.apple)').removeClass('show'); $(this).addClass('active-link'); $('a:not([href="#apple"])').removeClass('active-link'); } ); // Microsoft $('a[href="#microsoft"]').hover(function(){ $(".microsoft").addClass("show"); $('.fe-block:not(.microsoft)').removeClass('show'); $(this).addClass('active-link'); $('a:not([href="#microsoft"])').removeClass('active-link'); } ); // Facebook $('a[href="#facebook"]').hover(function(){ $(".facebook").addClass("show"); $('.fe-block:not(.facebook)').removeClass('show'); $(this).addClass('active-link'); $('a:not([href="#facebook"])').removeClass('active-link'); } ); // Instagram $('a[href="#instagram"]').hover(function(){ $(".instagram").addClass("show"); $('.fe-block:not(.instagram)').removeClass('show'); $(this).addClass('active-link'); $('a:not([href="#instagram"])').removeClass('active-link'); } ); // Google $('a[href="#google"]').hover(function(){ $(".google").addClass("show"); $('.fe-block:not(.google)').removeClass('show'); $(this).addClass('active-link'); $('a:not([href="#google"])').removeClass('active-link'); } ); }); </script> <style> .apple .html-block, .microsoft .html-block, .facebook .html-block, .instagram .html-block, .google .html-block { display: none; } .show .html-block { display: block !important; } .show { z-index: 999999 !important; } .active-link, .active-link * { color: #f1f !important; } </style>
#5. Explain