需要有关fullcalendar.js的帮助。当我在网络检查员上看到时,我发现了一个错误“Undefined is not a function”。但我认为代码很好。 您可以查看此小提琴https://jsfiddle.net/3kq85hx0/了解详细信息。
$(document).ready(function() {
var date = new Date();
var d = date.getDate();
var m = date.getMonth();
var y = date.getFullYear();
var calendar = $('#calendar').fullCalendar({
header: {
left: 'prev,next today',
center: 'title',
right: 'resourceDay,resourceWeek,resourceNextWeeks,resourceMonth'
},
defaultView: 'resourceWeek',
firstDay: 1,
editable: true,
selectable: true,
minTime: 8,
snapMinutes:10,
weekNumbers: false,
weekNumberTitle: 'Viikko ',
refetchResources: true,
maxTime:16,
selectHelper: true,
resources: 'json-resources.php',
events: [
{
title: 'Meeting from this day to this +4',
start: new Date(y, m, d, 10, 30),
end: new Date(y, m, d+4, 11, 00),
resource: 'resource1'
},
{
title: 'Meeting last week',
start: new Date(y, m, d-7, 10, 30),
end: new Date(y, m, d-7, 12, 15),
resource: 'resource1'
},
{
title: 'meeting tomorrow',
start: new Date(y, m, d+1, 10, 30),
end: new Date(y, m, d+1, 12, 00),
resource: 'resource1'
}
],
select: function(start, end, allDay, jsEvent, view, resource) {
var title = prompt('event title:');
if (title) {
calendar.fullCalendar('renderEvent',
{
title: title,
start: start,
end: end,
allDay: allDay,
resource: resource.id
},
true // make the event "stick"
);
}
calendar.fullCalendar('unselect');
},
resourceRender: function(resource, element, view) {
// this is triggered when the resource is rendered, just like eventRender
},
eventDrop: function( event, dayDelta, minuteDelta, allDay, revertFunc, jsEvent, ui, view ) {
alert('event moved to '+event.start+' to '+event.resource);
},
eventResize: function( event, dayDelta, minuteDelta, revertFunc, jsEvent, ui, view ) {
alert('event was resized, new endtime: '+event.end);
},
eventClick: function ( event, jsEvent, view ) {
alert('event '+event.title+' was left clicked');
}
});
});
感谢。
答案 0 :(得分:0)
" undefined不是函数"来自自定义fullcalendar脚本。具体在线 6373:
eventElement.draggable({
。
这是因为draggable
未定义。 draggable
是jqueryui的一部分,因此我删除了您的jquery ui脚本并从google's cdn添加了一个。
fiddle现在可以正常使用。
此外,正如评论中所讨论的,您使用的是旧版本的fullcalendar。这个特殊的自定义构建有一堆issues。
首先,我不知道您的计划有多长,但Adam Shaw目前正在对fullcalendar进行官方timeline更新。你可能想要注意这一点。