Jump to content

Google Calendar Pop-Up on Exisiting Header Button

Go to solution Solved by tuanphan,

Recommended Posts

Looking to add the below Google calendar pop-up to the "Book A Free Call" button in our header and "Stop Noodlin'" section.

It's currently a TypeForm pop-up, but looking to make the switch.

Website -> https://www.madebyapricot.com/

Code:
Google Calendar "Button With Pop Up"

<!-- Google Calendar Appointment Scheduling begin -->
<link href="https://calendar.google.com/calendar/scheduling-button-script.css" rel="stylesheet">
<script src="https://calendar.google.com/calendar/scheduling-button-script.js" async></script>
<script>
(function() {
  var target = document.currentScript;
  window.addEventListener('load', function() {
    calendar.schedulingButton.load({
      url: 'https://calendar.google.com/calendar/appointments/schedules/AcZssZ0pwSCOMh-CIFof5UzIT1yklZ5xgUBnUuZegMvNeTHKQ4bK77LjPlL6MAGx1spP7iDdPZKmwAOV?gv=true',
      color: '#039BE5',
      label: 'Book an appointment',
      target,
    });
  });
})();
</script>
<!-- end Google Calendar Appointment Scheduling -->

Link to comment

#0. Make sure header button, option "Open in New Tab" is disabled

#1. First, add your Google Calendar to Website Tools > Code Injection > Footer

image.thumb.png.ea7cc5efb3529369bd61ad5b0b97d95a.png

#2. Use this code to Website Tools > Custom CSS

button.qxCTlb {
    position: fixed;
    opacity: 0;
    transform: translateX(-1000px);
}

image.png.5adb10b5ad6008ffad93159d9a21bf83.png

#3. Use this code under #1 code

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.7.0/jquery.min.js"></script>
<script>
$(document).on('click', 'header#header a.btn', function(event) { 
    event.preventDefault(); 
    $('button.qxCTlb').click(); 
});
</script>

image.thumb.png.92eab2c80b428779453ab9a91496837b.png

#4. Result

image.thumb.png.361f233b1f1a02ce17d9641b059ca9b9.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!)

Link to comment
  • Solution

Change #3 code to this

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.7.0/jquery.min.js"></script>
<script>
$(document).on('click', 'header#header a.btn, div#block-yui_3_17_2_1_1708117493982_80427 a', function(event) { 
    event.preventDefault(); 
    $('button.qxCTlb').click(); 
});
</script>

and make sure that button url "Open in New Tab" is disabled

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!)

Link to comment

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.