Demo: https://tuanphan-demo01.squarespace.com/click-text-form-block-v2?noredirect
Password: abc
Suppose you have 2 Texts.
You want: when users hover on each Text > Show Form Block.
#1. First, you add a Text Block with some text/url.
Make sure the option “Open link in new tab” is disabled
- #form01
- #form02
and 2 Form Blocks below.
#2. Install Squarespace ID Finder to find the ID of the Form Block.
In my example, we will have:
- Form 01: #block-yui_3_17_2_1_1714617958451_9703
- Form 02: #block-yui_3_17_2_1_1714617958451_10361
#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(){ // Form 01 $("#block-yui_3_17_2_1_1714617958451_9703").closest('.fe-block').addClass('form01 show'); // Form 02 $("#block-yui_3_17_2_1_1714617958451_10361").closest('.fe-block').addClass('form02'); // Form 01 $('a[href="#form01"]').click(function(){ $(".form01").addClass("show"); $('.fe-block:not(.form01)').removeClass('show'); } ); // Form 02 $('a[href="#form02"]').click(function(){ $(".form02").addClass("show"); $('.fe-block:not(.form02)').removeClass('show'); } ); }); </script> <style> .form01 .form-block, .form02 .form-block { display: none; } .show .form-block { display: block !important; } .show { z-index: 999999 !important; } </style>
#4. Explain code