2012-03-12 146 views
0

這很奇怪。我只是試圖用共享的Google日曆來建立fullcalendar的基本功能。我嘗試用我自己的日曆URL簡單地替換gcal演示「gcal.html」。日曆自行開放。這裏是一些代碼:無法使用fullcalendar顯示Google日曆中的活動

<head> 
<link rel='stylesheet' type='text/css' href='../fullcalendar/fullcalendar.css' /> 
<link rel='stylesheet' type='text/css' href='../fullcalendar/fullcalendar.print.css' media='print' /> 
<script type='text/javascript' src='../jquery/jquery-1.7.1.min.js'></script> 
<script type='text/javascript' src='../jquery/jquery-ui-1.8.17.custom.min.js'></script> 
<script type='text/javascript' src='../fullcalendar/fullcalendar.min.js'></script> 
<script type='text/javascript' src='../fullcalendar/gcal.js'></script> 
<script type='text/javascript'> 

    $(document).ready(function() { 

     $('#calendar').fullCalendar({ 
     header: { 
       left: 'prev,next today', 
       center: 'title', 
       right: 'month,basicWeek,basicDay' 
      }, 
      // US Holidays 
      events: 'https://www.google.com/calendar/embed?src=r9k375tdhq8auc1oc4kgmhpri4%40group.calendar.google.com&ctz=America/Chicago', 
      eventClick: function(event) { 
       // opens events in a popup window 
       window.open(event.url, 'gcalevent', 'width=700,height=600'); 
       return false; 
      }, 

      loading: function(bool) { 
       if (bool) { 
        $('#loading').show(); 
       }else{ 
        $('#loading').hide(); 
       } 
      } 

     }); 

    }); 

</script> 

我非常確定,我擁有所有的依賴權利等,因爲我在gcal演示。當我將URL插入地址欄時,我的日曆將會打開。這個日曆設置爲公開的。任何幫助,將不勝感激。如果我可以使用它,Google日曆的完整日曆似乎是一個很好的配對。

回答

1

您沒有使用正確的網址。 FullCalendar需要一個XML提要,而不是整個日曆,這是你給它的。

See the documentation。以下步驟

嘗試:

你必須先使你的谷歌日曆市民:

In the Google Calendar interface, locate the "My Calendar" box on the left. 
Click the arrow next to the calendar you need. 
A menu will appear. Click "Share this calendar." 
Check "Make this calendar public." 
Make sure "Share only my free/busy information" is unchecked. 
Click "Save." 

然後,你必須取得日曆的XML供稿網址:

In the Google Calendar interface, locate the "My Calendar" box on the left 
Click the arrow next to the calendar you need. 
A menu will appear. Click "Calendar settings." 
In the "Calendar Address" section of the screen, click the XML badge. 
Your feed's URL will appear. 

我相信這是你想要的網址

https://www.google.com/calendar/feeds/r9k375tdhq8auc1oc4kgmhpri4%40group.calendar.google.com/public/basic

+0

謝謝布蘭登!知道這是愚蠢的,但我的眼睛不會看到它。謝謝! – Will 2012-03-12 22:09:56

+0

@會,沒問題。如果這解決了您的問題,請不要忘記您可以通過選中複選標記將其標記爲接受的答案。 – Brandon 2012-03-12 22:10:56

相關問題