fullcalendar

时间:2015-10-25 05:43:47

标签: javascript jquery fullcalendar momentjs

我试图让fullcalendar js启动并运行。所有文件都已上传。就我发现的指示而言,事情已经到位。

这是我的页面头中包含的内容:

<script type='text/javascript' src='/fullcalendar/fullcalendar.min.js'></script>
<link rel="stylesheet" href="/fullcalendar/fullcalendar.min.css">
<script type='text/javascript' src='/fullcalendar/gcal.js'></script>

<link href='/fullcalendar/fullcalendar.print.css' rel='stylesheet' media='print' />
<script src='/fullcalendar/lib/moment.min.js'></script>

我的网站目前在其他地方使用和加载jQuery,这就是为什么它没有在上面列出。

这就是我页面上的内容:

<script type='text/javascript'>

$(document).ready(function() {
    $('#calendar').fullCalendar({
        googleCalendarApiKey: 'Ao87hfiualhisitBO_eBlaJbwtuga13IM',
        events: {
            googleCalendarId: 'kljfho2938h98fah@group.calendar.google.com'
        }
    });
});

</script>

这些是我得到的错误:

Uncaught ReferenceError: moment is not defined
       (anonymous function) @ fullcalendar.min.js:6
       (anonymous function) @ fullcalendar.min.js:6
gcal.js:22 Uncaught TypeError: Cannot read property 'applyAll' of undefined
       (anonymous function) @ gcal.js:22
       (anonymous function) @ gcal.js:15
       (anonymous function) @ gcal.js:17
(index):328 Uncaught TypeError: $ is not a function
     (anonymous function) @ (index):328

任何想法或指示?任何有用的其他信息?

谢谢

1 个答案:

答案 0 :(得分:1)

您应该在moment.js

之前致电fullcalendar.js
<script src='/fullcalendar/lib/moment.min.js'></script>

<script type='text/javascript' src='/fullcalendar/fullcalendar.min.js'></script>
<link rel="stylesheet" href="/fullcalendar/fullcalendar.min.css">
<script type='text/javascript' src='/fullcalendar/gcal.js'></script>
<link href='/fullcalendar/fullcalendar.print.css' rel='stylesheet' media='print' />
  

jQuery和Moment必须在FullCalendar的JavaScript之前加载。

http://fullcalendar.io/docs/usage/