Jump to content

Google Scheduler Button CSS Customisation

Go to solution Solved by tuanphan,

Recommended Posts

Hi!

I'm trying to modify the styling of a Google Calendar button I've embedded into my site through a script. This button is for Google Calendar's 'single booking page', 'Button with popup' code.

GoogleButtononSquarespace.png.471878918eff382fcf3091ee505a3949.png

I've attached images of both the Google Calendar 'Website embed' page, as well as the style of the button on my website.

GoogleCalendarCode.thumb.png.cff7aae8d495e7cf7d8ef7e9ed008a9f.png

I'm new to CSS so I don't know how to call on that specific button. I'd wish to have control over button padding, radius of corners, font, font size, font colour, and button hover colour.

Site: https://grouper-fiddle-acdd.squarespace.com/

Password: ZxsZ9YW7Y5tUhCU

Any help is much appreciated!

Thanks!

Link to comment

Hi,

I see you replaced it with a Button Block.

Do you still need help? A few months ago, I helped a member, but my approach is, use Button Block, so you can CSS easier, then apply JS code, to make Google Schedule popup appears when clicking Button Block

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
On 3/11/2024 at 5:38 PM, ChrisMahoney said:

Hi @tuanphan, thanks for your reply!

Yes I would love it if you could guide me to make the Google Schedule popup appear when clicking the Button Block 🙂 I think I found your other thread about this, but I couldn't find a guide or code. From my end, I would only wish the popup to appear on click and not on hover.

Thanks @tuanphan!

You can send me this code, I will try testing on my site then give you full code

image.png.20f8c32daca9857e289d8699367b7876.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

Thanks @tuanphan! Here's the code:

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

Thanks!

Link to comment
On 3/14/2024 at 2:36 PM, ChrisMahoney said:

Thanks @tuanphan! Here's the code:

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

Thanks!

Have you sent full code? I think this code missing some thing.

I think under this line, still have some other code. Can you check again

I added that code to my site but nothing appears

image.thumb.png.49bce54355ff52dd7b4a13b1acbeca20.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

Oh goodness you're right, sorry about that @tuanphan! Here's the full code 🙂 Thanks!

<!-- 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/AcZssZ1oPptLqLtSUTNOygFbIjbEveZHVBOE4wohHmzSLto9PSbioOuGAEoo6rzvMAK6GNc8En8Kddrt?gv=true',
      color: '#039BE5',
      label: 'Book an appointment',
      target,
    });
  });
})();
</script>
<!-- end Google Calendar Appointment Scheduling -->

 

Link to comment
On 3/15/2024 at 10:13 PM, ChrisMahoney said:

Oh goodness you're right, sorry about that @tuanphan! Here's the full code 🙂 Thanks!

<!-- 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/AcZssZ1oPptLqLtSUTNOygFbIjbEveZHVBOE4wohHmzSLto9PSbioOuGAEoo6rzvMAK6GNc8En8Kddrt?gv=true',
      color: '#039BE5',
      label: 'Book an appointment',
      target,
    });
  });
})();
</script>
<!-- end Google Calendar Appointment Scheduling -->

 

I tried creating an example, you try checking

https://tuanphan5-test.squarespace.com/google-scheduler?noredirect

pass: abc

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
On 3/18/2024 at 9:35 PM, ChrisMahoney said:

That's exactly what I was after @tuanphan, thanks! Could you kindly provide me with the steps to implement this in my site?

First add a Code Block with Google Scheduler Code

image.thumb.png.ea4075ad5e64ea7c3ec53660d63d572d.png

Next, add a Button Block with this URL. And make sure "Open in new tab" DISABLED

#google-scheduler

image.thumb.png.c4ae7f2d5413c546822d2614d88cf411.png

Next, use this code to Page Header Code Injection

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

image.thumb.png.06a515e11de98f63714ff1578c78289f.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

Thanks so much @tuanphan, that worked great!

I have a further two questions if that's OK…

Question 1: There's a similar button for people to schedule a meeting in the Site Header, however when I updated the link to "#google-scheduler" nothing happens. Is there a way we can make it behave the same way as the other button?

Question 2: I had another code block near this button, that placed a vertical line between the button and the text to the right.

The code block just says :

<div class="vertical-line"></div>

and is then styled in CSS.

This line is now hidden as well, I imagine because the Page Header Code Injection you provided is hiding all code blocks. Is there a way we could only target the code block that contains the Google Scheduler code, so that I can see the vertical line again?

 

Site: https://grouper-fiddle-acdd.squarespace.com/

Password: abc123

Sorry for all the questions, and thanks so much for your help!

Link to comment
1 hour ago, ChrisMahoney said:

Thanks so much @tuanphan, that worked great!

I have a further two questions if that's OK…

Question 1: There's a similar button for people to schedule a meeting in the Site Header, however when I updated the link to "#google-scheduler" nothing happens. Is there a way we can make it behave the same way as the other button?

Question 2: I had another code block near this button, that placed a vertical line between the button and the text to the right.

The code block just says :

<div class="vertical-line"></div>

and is then styled in CSS.

This line is now hidden as well, I imagine because the Page Header Code Injection you provided is hiding all code blocks. Is there a way we could only target the code block that contains the Google Scheduler code, so that I can see the vertical line again?

 

Site: https://grouper-fiddle-acdd.squarespace.com/

Password: abc123

Sorry for all the questions, and thanks so much for your help!

#1. You mean, you want when users click Header button >> Open GG Calendar Lightbox?

I see click Footer button > It open GG Lightbox here

#2. Change this code

image.png.8b1cd87807b80827d2dad4313065ab01.png

to this

<style>
  div#block-yui_3_17_2_1_1710842714387_63053 {
    visibility: hidden;
}
</style>

 

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
Posted (edited)
26 minutes ago, tuanphan said:

#1. You mean, you want when users click Header button >> Open GG Calendar Lightbox?

I see click Footer button > It open GG Lightbox here

Hi @tuanphan 🙂 Yes when you tested it, it had the actual GG Calendar link there, sorry about that. I've now changed the link again to "#google-scheduler" instead of the GG URL, and nothing happens when I click on it. Just to be clear, I'm attaching a screenshot of the button I'm referring to, the one at the top-right corner.

image.thumb.png.7dd6a2152f52a97cb7a1d441a1ebcee4.png

Regarding question 2, I can see the line again, many thanks!!

Edited by ChrisMahoney
Added image of button
Link to comment
  • 2 weeks later...

Hi @tuanphan, I actually managed to sort this out, with some help from ChatGPT 🙂 In case anyone in the future finds this thread useful, all I did differently from @tuanphan's instructions was to change the JavaScript code he had given me to the following:

<!-- Specific button on homepage to open Google Cal Scheduler in-page booking -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.7.0/jquery.min.js"></script>
<script>
$(document).ready(function() {
    $('#block-05bd4d554ce0a8dfe638').click(function(event) {
        event.preventDefault();
        $('.code-block button').click();
    });
});
</script>

… where the text '#block-05bd4d554ce0a8dfe638' is the unique ID of the button that I wanted to call on the JavaScript code.

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.