You can send your questions to my email to get faster answer in 24 hours (free).
Buy me a coffee

Click button – Show Newsletter v2

Demohttps://tuanphan-demo01.squarespace.com/click-button-show-newsletter-v2?noredirect

Password: abc

Suppose you have 2 buttons and 2 Newsletters.

And you want: when clicking on the Button, the Newsletter will appear below it.

You can follow these steps:

#1. First, add 2 Button Blocks and 2 Newsletter

click-button-show-newsletter-01-min

#2. Edit 2 Button Blocks, and use these URLs:

  • #forbuyer
  • #forseller

and make sure the option “Open Link in New Tab” is disabled.

click-button-show-newsletter-02-min click-button-show-newsletter-03-min

#3. Install Squarespace ID Finder to find the ID of Buttons and Newsletters.

In my example, we will have:

  • For Buyer: #block-f7bddfd9e6204e5b23f2
  • For Seller: #block-47ea5c1ca0ea9b1d02ec

 

  • Newsletter 1: #block-7410df8c50a7724d4fcc
  • Newsletter 2: #block-3b3a7f22b741c66555b9

click-button-show-newsletter-v2-min

#4. 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(){
  // For Buyer 
  $("#block-7410df8c50a7724d4fcc").closest('.fe-block').addClass('forbuyer show');
  // For Seller
$("#block-3b3a7f22b741c66555b9").closest('.fe-block').addClass('forseller');
  
  // For Buyer 
  $('a[href="#forbuyer"]').click(function(){
    $(".forbuyer").addClass("show");
    $('.fe-block:not(.forbuyer)').removeClass('show');
    $(this).addClass('active-button');
    $('a:not([href="#forbuyer"])').removeClass('active-button');
    }
  );
// For Seller
 $('a[href="#forseller"]').click(function(){
   $(".forseller").addClass("show");
    $('.fe-block:not(.forseller)').removeClass('show');
    $(this).addClass('active-button');
    $('a:not([href="#forseller"])').removeClass('active-button')
    }
  );
});
</script>
<style>
.forbuyer .newsletter-block, .forseller .newsletter-block {
    display: none;
}
  .show .newsletter-block {
      display: block !important;
  }
  .show {
      z-index: 999999 !important;
  }
  .active-button {
  background-color: green !important;
  }
</style>

click-button-show-newsletter-v2-04-min

#5. Explain code

click-button-show-newsletter-v2-06-min

Ask me a question, free

If your site is private or in trial, just setup password and share url. See how to: https://beaverhero.com/squarespace-how-to/
Please check your email carefully. Recently I got a lot of questions with wrong emails.

If you haven't heard from me within 24 hours please check your junk/spam folder