我一直在使用Fullcalendar,一切正常,除了当我尝试进入“天”视图时(例如,单击右上角的“天”按钮,或单击中的特定日期日历),我将收到以下错误消息(即使当天应该有事件,一天也将显示为空,没有任何事件),能否请您提示我什么可能是问题/如何解决?
我正在使用最新版本的Fullcalendar,v3.9.0。谢谢!
Uncaught TypeError: Cannot read property 'top' of null
at t.getTopPosition (momentfullcalendar.js:15)
at e.computeTimeTop (momentfullcalendar.js:18)
at e.computeInitialDateScroll (momentfullcalendar.js:18)
at e.applyScroll (momentfullcalendar.js:14)
at e.applyQueuedScroll (momentfullcalendar.js:14)
at e.popScroll (momentfullcalendar.js:14)
at e.onRenderQueueStop (momentfullcalendar.js:14)
at e (momentfullcalendar.js:13)
at e.dispatch (all1.js?v=40:3)
at e.q.handle (all1.js?v=40:3)
这是我的日历代码:
var ev = [];
$('.cal-class-data').each(function(){
var title = $(this).attr('data-name');
var start = $(this).attr('data-time');
var s = new Date(start.replace(/-/g, '/'));
var end = moment(s).add($(this).attr('data-duration'), 'm');
var url = $(this).attr('data-url');
var className = ['all-classes', 'sub-' + $(this).attr('data-sub'), 'cat-' + $(this).attr('data-cat')];
var x = {title: title,start: s,end: end,url: url, className: className};
ev.push(x);
});
var calendar = $('#calendar').fullCalendar({
header:
{
left: 'prev,next',
center: 'title',
right: opt
},
titleFormat: 'MMM D YYYY',
defaultView: 'month',
allDaySlot:false,
navLinks:true,
minTime: $('#min_hour').text() + ":00:00",
maxTime: $('#max_hour').text() + ":00:00",
firstDay:1,
eventBackgroundColor:'#31B39D',
eventBorderColor: 'white',
height:'auto',
events: ev,
});