Jump to content

[Share] Hover Text Block – Fade an Image

Recommended Posts

Posted

You can add a Text Block and an Image Block. Something like this.

image.png.d0efce0bdab731c609ab3b60a3efae5f.png

Next, find ID of 2 Blocks.

In my example, it is:

  • Text Block: #block-yui_3_17_2_1_1730253152365_10737
  • Image Block: #block-yui_3_17_2_1_1732097629910_12028

image.png.c99008e996fd875a8faedaf6d2112628.png

Next, use this code to Code Injection > Footer

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.7.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
$('#block-yui_3_17_2_1_1730253152365_10737').hover(
    function() {
        $('#block-yui_3_17_2_1_1732097629910_12028').fadeOut(500);
        $(this).css('transform', 'scale(1.05)');
    },
    function() {
        $('#block-yui_3_17_2_1_1732097629910_12028').fadeIn(500);
        $(this).css('transform', 'scale(1)');
    }
);
});
</script>

image.png.e87f78aa93d4ac11aa78c16d1f7b6f24.png

You can change ID here

image.png.e6363b928566e31c3ded6b0d0ecc3452.png

If your plan doesn’t support Code Injection, you can use this code to Custom CSS box

body:has(div#block-yui_3_17_2_1_1730253152365_10737:hover) #block-yui_3_17_2_1_1732097629910_12028 {
    opacity: 0;
}

image.png.089f2c73b6fbac41eac78a7433c1f784.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 68
  • 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.