Buy me a coffee

Hover Button – Show Summary Block

Demo: https://tuanphan-demo01.squarespace.com/hover-button-show-summary-block?noredirect

Password: abc

Description: Hover on each button > Show the corresponding Summary Block.

#1. First, you add 2 Button Blocks with some text/url.

Make sure the option “Open link in new tab” is disabled

  • #summary01
  • #summary02

Hover Button Show Summary Block 01 Min

Hover Button Show Summary Block 02 Min

and 2 Summary Blocks below.

Hover Button Show Summary Block 03 Min

#2. Install Squarespace ID Finder to find the ID of the Summary Block.

In my example, we will have:

  • Left Summary Block: #block-yui_3_17_2_1_1715307967768_21203
  • Right Summary Block: #block-yui_3_17_2_1_1715307967768_26779

Hover Button Show Summary Block 04 Min

#3. Use 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(){
  // Summary 01 
  $("#block-yui_3_17_2_1_1715307967768_21203").closest('.fe-block').addClass('summary01 show');
  $('a[href="#summary01"]').addClass('active-button');
  // Summary 02
$("#block-yui_3_17_2_1_1715307967768_26779").closest('.fe-block').addClass('summary02');
  
  // Summary 01 
  $('a[href="#summary01"]').hover(function(){
    $(".summary01").addClass("show");
    $('.fe-block:not(.summary01)').removeClass('show');
    $(this).addClass('active-button');
    $('a:not([href="#summary01"])').removeClass('active-button');
    }
  );
// Summary 02
 $('a[href="#summary02"]').hover(function(){
   $(".summary02").addClass("show");
    $('.fe-block:not(.summary02)').removeClass('show');
    $(this).addClass('active-button');
    $('a:not([href="#summary02"])').removeClass('active-button')
    }
  );
});
</script>
<style>
.summary01 .summary-v2-block, .summary02 .summary-v2-block {
    display: none;
}
  .show .summary-v2-block {
      display: block !important;
  }
  .show {
      z-index: 999999 !important;
  }
  .active-button {
  background-color: green !important;
  }
</style>

Hover Button Show Summary Block 08 Min

 

#4. Explain code

Hover Button Show Summary Block 06 Min