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
  • 1 month later...

I have followed your codes based on this chat above, but on the home page and the header throughout the website, the close button on the google calendar pop up won't work. It works on the pop ups when you scroll to a different button lower on the page (except the home page). This is the only piece I need to figure out to help make this happen for a website. Can you help me out @tuanphan?

Link to comment
On 7/12/2024 at 9:56 PM, Roman1222 said:

I have followed your codes based on this chat above, but on the home page and the header throughout the website, the close button on the google calendar pop up won't work. It works on the pop ups when you scroll to a different button lower on the page (except the home page). This is the only piece I need to figure out to help make this happen for a website. Can you help me out @tuanphan?

Can you share site url? We can check easier

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

I deleted the code and I'm still having a problem with the close button not working on the home page. The header button goes to a black page with written code instead of showing the calendar. Let me know what you can do when you get the time. Thanks for the update on response time. I appreciate it.

Link to comment
On 7/19/2024 at 10:28 PM, Roman1222 said:

I deleted the code and I'm still having a problem with the close button not working on the home page. The header button goes to a black page with written code instead of showing the calendar. Let me know what you can do when you get the time. Thanks for the update on response time. I appreciate it.

Have you disabled option "Open in New Tab" yet?

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.