我有一个工作成功的日历,但是加载时间非常慢。每个事件都能成功呈现,但用户在切换视图或浏览月份/周/天时必须等待5-10秒。
我已经显示了下面的事件加载代码,有什么我可以做它,使它加载更快?
感谢<script type='text/javascript'>
$(document).ready(function () {
var date = new Date();
var d = date.getDate();
var m = date.getMonth();
var y = date.getFullYear();
var calendar = $('#calendar').fullCalendar({
//events: [{"title":"My Test Event","start":"Wed, 02 Nov 2011 13:00:00 EST","url":"http://edu","allDay":"false"}],
events: "JSONcalendarFeed.aspx",
defaultView: 'month',
weekends: false,
allDay: false,
minTime: 8,
maxTime: 19,
allDaySlot: false,
slotMinutes: 15,
weekMode: 'liquid',
defaultEventMinutes: 60,
firstHour: 8,
header: {
left: 'month,agendaWeek,agendaDay',
center: 'title',
right: 'prev,next today'
},
eventRender: function (event, element) {
var evtDesc = event.description;
var evtStart = event.start;
var evtEnd = event.end;
if (evtDesc || evtStart) {
element.qtip(
{
content: evtStart + ' - ' + evtEnd + '<br/>' + evtDesc,
position: {
corner: {
target: 'bottomMiddle',
tooltip: 'topMiddle'
}
},
style: {
name: 'light'
}
}
);
}
},
selectable: true,
selectHelper: true,
select: function (start, end, allDay) {
var title = prompt('Event Title:');
if (title) {
calendar.fullCalendar('renderEvent',
{
title: title,
start: start,
end: end,
allDay: false,
weekends: false
},
true // make the event "stick"
);
}
calendar.fullCalendar('unselect');
},
editable: true
});
});
</script>
总结一下注释:
不要发送提要中的所有事件,而只发送发生在start和end之间的事件,这是fullCalendar发送给提要页面的参数。这些以unix时间戳的形式发送,单位为秒。