【问题标题】:JQuery FullCalendar not rendering events on initial viewJQuery FullCalendar 不在初始视图上呈现事件
【发布时间】:2013-11-12 21:00:30
【问题描述】:

我正在做一个基本的 FullCalendar。当日历首次呈现为空白时,即使该月有事件。如果我去下个月然后返回当月显示事件,当你登陆这些月份时,所有其他有事件的月份都会正确显示。去年有人问过一个类似的问题,但没有找到有效的解决方案。

我正在新窗口中打开日历。下面是相关的日历 html 和 js 代码。如果我将日历放在主页上,它会正确打开。仅当我打开一个新窗口并将日历放入其中时才会出现此问题。

//from calendar.html
<!DOCTYPE html>
<html>
  <head>
    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
    <script type="text/javascript" src="fullcalendar.js"></script>
    <link href="fullcalendar.css" rel="stylesheet">
  </head>
  <body>
    <script src="calendar-script.js" type="text/javascript"></script>
    <div id="calendar"></div>
  </body>
</html>

//from calendar-script.js
(function() {
  $(document).ready(function($) {
    //code to get the event data and generate the eventsArray
    $('#calendar').fullCalendar({
      events: eventsArray
    });
  });
})();

【问题讨论】:

    标签: jquery fullcalendar


    【解决方案1】:

    这段代码是我第一个 Javascript/JQuery 项目的一部分,我显然忘记了 Ajax 中的 A 代表什么。我正在使用 Ajax 调用来获取数据,并在 Ajax 成功函数之外调用了日历。将日历功能放在Ajax成功功能的末尾解决了这个问题。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-05-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-03-09
      • 1970-01-01
      相关资源
      最近更新 更多