0

我正在使用 ajax 加载的页面中使用 FullCalendar 插件。加载页面后,我得到的只是标题按钮,但在单击其中一个按钮(月/周/日)之前,日历本身不会显示。

这是我的代码:

$('#calendar').fullCalendar({
    header: { left: 'next,prev, today', center: 'title', right: 'month,basicWeek,basicDay'},
    isRTL: true,
    height: 540,
    events: {
        url: "../practice/AjaxJson",
        cache: true
    },
    timeFormat: 'H(:mm)'
});     

如果我将此代码放在一个函数中并使用设置为 1500 毫秒的 setTimeout 调用它,它就可以工作。

有没有更好的解决方案?

4

1 回答 1

0
  1. 只需在 dom 准备好后尝试放置您的代码。
  2. 使用 renderEvents ( http://arshaw.com/fullcalendar/docs/event_rendering/rerenderEvents/ )
  3. 确保您没有在隐藏元素上加载日历。
于 2014-08-11T09:44:13.053 回答