Jump to content

[Share] Hover text - show more text on Right

Recommended Posts

Posted

Description: Hover text (on left) - Show more text (on right)

Demo: https://tuanphan-demo01.squarespace.com/hover-text-show-more-text?noredirect

Pass: abc

If the code doesn't work on your site, you can send site url + which exact code you added, I can check easier.

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.

image.png.3266d7b48acb4926c5736bb429f64386.png

#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 need to remove underline under text, you can comment below, I will give the code

image.png.51ee2f0daffe0c753eb7ce86a4ccedad.png image.png.4ae1da04f1a77bd9fae103da92c266e0.png

image.png.d56f1fdebb2cd34b942439c580a38942.png

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

image.png.a503ffa96270dd4813fe69a8cc60750b.png

#3. Find ID of Text Block (Left) and 5 Text Blocks (Right)

In my 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

image.png.c784f04cae6b98a88435fe31b4df0023.png

#4. Use this code to Individual Page Header Injection (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>

image.png.353871763bfe0af749d3b7dbd07a12bc.png

#5. Explain a bit

image.png.fefcd84a85b0c6ab8df67c8056d28bff.png

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!)

  • Replies 0
  • Views 631
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

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.