如何将移动版 Google 日历嵌入到移动网站中

发布于 2024-11-05 09:40:30 字数 70 浏览 1 评论 0原文

我正在尝试将移动版本的 Google 日历嵌入到移动网站中,而无需登录。如果有人以前可以使用此功能或知道如何操作,请提供帮助。

I am trying to get a mobile version of a Google calendar to embed into a mobile website without having to log in. If anybody has gotten this to work before or has any idea how to do it please help.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

一杯敬自由 2024-11-12 09:40:31

这是我对我的网站所做的,它非常适合我的 Google 日历需求。

我使用了 Google 日历嵌入代码,但我更改了在移动设备上嵌入的日历类型,以便内容适合屏幕。只要小容器的“&mode=”等于“AGENDA”,它就应该显示议程列表,但您可以直接从 Google 日历中复制此列表。

我对宽度设置为“100%”、高度设置为“650”的大容器使用“月”日历嵌入选项,如下所示:

<div class="responsive-iframe-container big-container">
<iframe src="https://calendar.google.com/calendar/embed?
showTitle=0&showNav=0&showPrint=0&showTabs=0&showCalendars=0&showTz=0&height
=700&wkst=1&bgcolor=%23db694f&src=123123123%40group.calendar.
google.com&color=%23fbdbac&ctz=America%2FLos_Angeles" style="border-width:0" 
width="100%" height="650" frameborder="0" scrolling="no"></iframe>
</div>

然后对宽度设置为“100”的移动设备使用“议程”日历嵌入选项%”和高度“600”,如下所示:

<div class="responsive-iframe-container small-container">
<iframe src="https://calendar.google.com/calendar/embed?
showTitle=0&showNav=0&showPrint=0&showTabs=0&showCalendars=0&showTz=0
&mode=AGENDA&height=800&wkst=1&bgcolor=%23db694f&src=123123123
%40group.calendar.google.com&color=%23B1440E&ctz=America%2FLos_Angeles" 
style="border-width:0" width="100%" height="600" frameborder="0" 
scrolling="no"></iframe>
</div>

这将为您提供移动设备上可滚动的响应式 iFrame 议程列表,同时在桌面上仍具有大日历视图。

最后,您需要将这些样式添加到页面中

<style>
@media (max-width: 550px) {
   .big-container {
       display: none;
   }
}
@media (min-width: 550px) {
   .small-container {
       display: none;
   }
}
/* Responsive iFrame */
.responsive-iframe-container {
   position: relative;
   padding-bottom: 56.25%;
   padding-top: 30px;
   height: 0;
   overflow: hidden;
}
.responsive-iframe-container iframe,   
.responsive-iframe-container object,  
.responsive-iframe-container embed {
   position: absolute;
   top: 0;
   left: 0;
   width: 100%;
   height: 100%;
}
</style>

Here's what I did with my site, and it works great for my Google calendar needs.

I used Google Calendar embed code, but I changed the type of calendar I was embedding on mobile so the content fits on the screen. As long as the "&mode=" equals "AGENDA" for the small container it should display the agenda list, but you can copy this from directly within your Google Calendar.

I used the "month" calendar embed option for the big container with a width set to "100%" and a height of "650" like so:

<div class="responsive-iframe-container big-container">
<iframe src="https://calendar.google.com/calendar/embed?
showTitle=0&showNav=0&showPrint=0&showTabs=0&showCalendars=0&showTz=0&height
=700&wkst=1&bgcolor=%23db694f&src=123123123%40group.calendar.
google.com&color=%23fbdbac&ctz=America%2FLos_Angeles" style="border-width:0" 
width="100%" height="650" frameborder="0" scrolling="no"></iframe>
</div>

Then used the "agenda" calendar embed option for mobile devices with a width of "100%" and a height of "600" like so:

<div class="responsive-iframe-container small-container">
<iframe src="https://calendar.google.com/calendar/embed?
showTitle=0&showNav=0&showPrint=0&showTabs=0&showCalendars=0&showTz=0
&mode=AGENDA&height=800&wkst=1&bgcolor=%23db694f&src=123123123
%40group.calendar.google.com&color=%23B1440E&ctz=America%2FLos_Angeles" 
style="border-width:0" width="100%" height="600" frameborder="0" 
scrolling="no"></iframe>
</div>

This will give you a responsive iFrame agenda list on mobile that can be scrolled through, while still having the large calendar view on desktop.

Lastly, you need to add these styles to the page

<style>
@media (max-width: 550px) {
   .big-container {
       display: none;
   }
}
@media (min-width: 550px) {
   .small-container {
       display: none;
   }
}
/* Responsive iFrame */
.responsive-iframe-container {
   position: relative;
   padding-bottom: 56.25%;
   padding-top: 30px;
   height: 0;
   overflow: hidden;
}
.responsive-iframe-container iframe,   
.responsive-iframe-container object,  
.responsive-iframe-container embed {
   position: absolute;
   top: 0;
   left: 0;
   width: 100%;
   height: 100%;
}
</style>
飘过的浮云 2024-11-12 09:40:31

如今,有许多第三方应用程序可以轻松嵌入移动响应式 Google 日历。

这里有几个选项:

或者,如果您更愿意使用开源软件,FullCalendar 是一个很好的解决方案。他们有一个日历列表视图,在移动设备上效果特别好。如果您希望桌面和移动布局不同,您可以使用 调整日历容器上的观察者大小以触发FullCalendar的changeView方法。以下是有关如何使用 FullCalendar 的 Google 日历插件的一些文档:https://fullcalendar.io/docs/google -calendar

*全面披露,我是 样式日历团队

These days, there are a number of third party apps that make it easy to embed mobile-responsive Google calendars.

Here are a couple of options:

Or, if you'd rather use something open source, FullCalendar is a great solution. They have a calendar list view that works particularly well on mobile. If you wanted the desktop and mobile layouts to be different, you could potentially use a resize observer on the calendar's container to trigger FullCalendar's changeView method. Here is some documentation on how to use FullCalendar's Google Calendar plugin: https://fullcalendar.io/docs/google-calendar

*Full disclosure, I'm a member of the Styled Calendar team

汹涌人海 2024-11-12 09:40:31

为了让每个人都能看到您的日历,您需要将其公开。

为了以防万一,将日历嵌入您的网站的方法如下:

  1. 在左侧的日历列表中,单击要嵌入的日历旁边的向下箭头,然后选择“日历设置”。 (或者,单击日历列表底部的“设置”链接,然后单击日历的名称。)
  2. 复制“嵌入此日历”部分中显示的 iframe 代码。
  3. 将此代码粘贴到您的网站中以嵌入您的日历。

上述说明取自Google 日历支持“嵌入您的网站”

To allow everyone to see your calendar, you'll need to make it public.

And just in case, here's how to embed the calendar on your website:

  1. In the calendar list on the left, click the down-arrow next to the calendar you want to embed, and select Calendar settings. (Alternatively, click the Settings link at the bottom of the calendar list, then click the name of the calendar.)
  2. Copy the iframe code displayed in the Embed This Calendar section.
  3. Paste this code into your website to embed your calendar.

The instructions above were taken from Google's Calendar Support "Embed on your website".

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文