Jump to content

[Share] Hover Text - Show Image on Right

Recommended Posts

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.

image.thumb.png.edb09a396f44940707467e932d132536.png

#1. First, add a Text Block with 5 Paragraph, then add these URLs

  • Apple – #apple
  • Microsoft – #microsoft
  • Facebook – #facebook
  • Instagram – #instagram
  • Google – #google

hover-text-show-more-text-on-right-03-min.jpg.8c59df3c1c001cf99e4363d1e3648110.jpg

and make sure “Open Link in new tab” is DISABLED.

hover-text-show-more-text-on-right-02-min.jpg.ce50bd22b31addaf075e1087422d2cb1.jpg

#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).

hover-text-show-more-text-on-right-07-min.jpg.6022a30566708a62cf8df831e18ffbe2.jpg

#3. Install Squarespace ID Finder tool (Free)

https://chromewebstore.google.com/detail/squarespace-id-finder/igjamfnifnkmecjidfbdipieoaeghcff

 

hover-text-show-more-text-on-right-08-min.png.e567858732c9f07f01b68b2ea2d17854.png

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>

hover-text-show-more-text-on-right-12-min.png.970868b63440c6a26904a3506f6a10c6.png

#5. Explain a bit

hover-text-show-more-text-on-right-10-min.jpg.0de0af30943107bd7fbb7f4f37950070.jpg

hover-text-show-more-text-on-right-11-min.jpg.760f4650d11311d4bbbd3d78bf5a57be.jpg

Edited 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
  • tuanphan changed the title to [Share] Hover Text - Show Image on Right
  • 5 months later...
  • Replies 1
  • Views 1.5k
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Posted Images

Create an account or sign in to comment

You need to be a member in order to leave a comment


×
×
  • Create New...

Squarespace Webinars

Free online sessions where you’ll learn the basics and refine your Squarespace skills.

Hire a Designer

Stand out online with the help of an experienced designer or developer.