(Squarespace/Contact Form Widget) Click Announcement Bar - Show Contact Form Widget

Description: Click Announcement Bar >> Open Contact Form Widget on Right Side.

#1. First, install Contact Form Widget and setup this option in widget.

#2. Add a hyperlink on Announcement Bar with URL: #contact
Something like this

#3. Use this code to Website > Website Tools > Code Injection > Footer in Squarespace

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.7.0/jquery.min.js"></script>
<script>
$(document).on('click', 'div.sqs-widget.sqs-announcement-bar a[href="#contact"]', function(event) { 
    event.preventDefault(); 
    $('div[class*="FloatingButton__FloatingButtonContainer-"] button').click(); 
});
</script>
<style>
  div[class*="FloatingButton__FloatingButtonContainer-"] {
  opacity: 0;
  }
</style>

#4. Result
When clicking Free Consultation text in Announcement Bar, a Contact Form will slide from right of screen.

2 Likes