Buy me a coffee

Hover Text – Change Video (v2)

Demo: https://tuanphan-demo01.squarespace.com/hover-text-change-video-v2?noredirect

Password: abc

Suppose you have 4 texts.
You want: when users hover on each text >> Change video on the right.

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

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

Make sure “Open Link in new tab” is DISABLED.

Hover Text Change Video 01 Min

Hover Text Change Video 02 Min

Hover Text Change Video 03 Min

Hover Text Change Video 04 Min

and 4 video blocks on the right

Hover Text Change Video 05 Min

#2. Use this free tool to find the ID of Image and Video Blocks

In my example, we will have:

  • Left text block: #block-81180abeb3d1bb243568
  • Apple video: #block-6147b092aa559d47a4df
  • Microsoft video: #block-8474988d8d52cc1d2334
  • Instagram video: #block-0f4a6585a6c4af3b7f56
  • Google video: #block-4b5750400e8336b00078

Hover Text Change Video V2 01 Min

#3. Use this 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(){
   $("#block-6147b092aa559d47a4df").addClass("show");
  // Apple
  $('#block-81180abeb3d1bb243568 a[href="#apple"]').hover(function(){
    $("#block-6147b092aa559d47a4df").addClass("show");
    $('div:not(#block-6147b092aa559d47a4df)').removeClass('show');
    }
  );
// Microsoft
 $('#block-81180abeb3d1bb243568 a[href="#microsoft"]').hover(function(){
    $("#block-8474988d8d52cc1d2334").addClass("show");
    $('div:not(#block-8474988d8d52cc1d2334)').removeClass('show');
    }
  );
  // Instagram 
   $('#block-81180abeb3d1bb243568 a[href="#instagram"]').hover(function(){
    $("#block-0f4a6585a6c4af3b7f56").addClass("show");
      $('div:not(#block-0f4a6585a6c4af3b7f56)').removeClass('show');
    }
  );
  // Google
   $('#block-81180abeb3d1bb243568 a[href="#google"]').hover(function(){
    $("#block-4b5750400e8336b00078").addClass("show");
      $('div:not(#block-4b5750400e8336b00078)').removeClass('show');
    }
  );
});
</script>
<style>
#block-6147b092aa559d47a4df, #block-8474988d8d52cc1d2334, #block-0f4a6585a6c4af3b7f56, #block-4b5750400e8336b00078 {
  opacity: 0;
  transition: all 0.1s ease;
  }
  .show {
  opacity: 1 !important;
     transition: all 0.1s ease;
  }
</style>

Hover Text Change Video V2 02 Min

#4. Explain code

Hover Text Change Video V2 03 Min