tuanphan Posted March 14 Share Posted March 14 (edited) You can see demo here https://tuanphan3.squarespace.com/hover-text-show-image-example?noredirect pass: abc Suppose you have 5 texts: Apple, Microsoft, Facebook, Instagram, and Google. You want: when users hover on each text > show an image 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 “Open Link in new tab” is DISABLED. #2. Add 5 Image 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) https://chromewebstore.google.com/detail/squarespace-id-finder/igjamfnifnkmecjidfbdipieoaeghcff Then, you can find the ID of 5 Image Blocks and Text Block with the tool. In this example, we will have Text Block: #block-yui_3_17_2_1_1709027479615_23578 Apple Image: #block-yui_3_17_2_1_1709027479615_25260 Microsoft: #block-yui_3_17_2_1_1709027479615_25837 Facebook: #block-yui_3_17_2_1_1709027479615_26404 Instagram: #block-yui_3_17_2_1_1709027479615_26980 Google: #block-yui_3_17_2_1_1709027479615_27455 #4. Use this code to Code Injection - Footer or Page Header Code Injection (page where you want to apply this effect) <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_1709027479615_23578 a[href="#apple"]').hover(function(){ $("#block-yui_3_17_2_1_1709027479615_25260").addClass("show"); }, function(){ $('#block-yui_3_17_2_1_1709027479615_25260').removeClass("show"); } ); // Microsoft $('#block-yui_3_17_2_1_1709027479615_23578 a[href="#microsoft"]').hover(function(){ $("#block-yui_3_17_2_1_1709027479615_25837").addClass("show"); }, function(){ $('#block-yui_3_17_2_1_1709027479615_25837').removeClass("show"); } ); // Facebook $('#block-yui_3_17_2_1_1709027479615_23578 a[href="#facebook"]').hover(function(){ $("#block-yui_3_17_2_1_1709027479615_26404").addClass("show"); }, function(){ $('#block-yui_3_17_2_1_1709027479615_26404').removeClass("show"); } ); // Instagram $('#block-yui_3_17_2_1_1709027479615_23578 a[href="#instagram"]').hover(function(){ $("#block-yui_3_17_2_1_1709027479615_26980").addClass("show"); }, function(){ $('#block-yui_3_17_2_1_1709027479615_26980').removeClass("show"); } ); // Google $('#block-yui_3_17_2_1_1709027479615_23578 a[href="#google"]').hover(function(){ $("#block-yui_3_17_2_1_1709027479615_27455").addClass("show"); }, function(){ $('#block-yui_3_17_2_1_1709027479615_27455').removeClass("show"); } ); }); </script> <style> #block-yui_3_17_2_1_1709027479615_25837, #block-yui_3_17_2_1_1709027479615_25837, #block-yui_3_17_2_1_1709027479615_26404, #block-yui_3_17_2_1_1709027479615_26980, #block-yui_3_17_2_1_1709027479615_27455, #block-yui_3_17_2_1_1709027479615_25260 { opacity: 0; transition: all 0.1s ease; } .show { opacity: 1 !important; transition: all 0.1s ease; } </style> #5. Explain a bit Edited March 16 by tuanphan edit title 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
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment