【问题标题】:FullCalendar in IE8 - events not renderingIE8 中的 FullCalendar - 事件未呈现
【发布时间】:2012-07-07 00:23:54
【问题描述】:

这是其他人遇到的问题,但其他地方列出的解决方案都没有对我有用。我正在使用 FullCalendar 1.5.3 缩小版(尽管有趣的是,非缩小版有所不同——它没有调用我的完整函数。不过那是另一回事)。

这是我生成的 javascript/JSON(从数据库输出):

$(document).ready(function() {
    var colours = new Array();
    colours[159] = '#ED8E00';
    colours[160] = '#531493';
    colours[161] = '#69A2E2';
    colours[162] = '#C39';
    colours[163] = '#DEED42';

    $('#calendar').fullCalendar({
       header: {
         left: 'prev,next today',
         center: 'title',
         right: 'month,basicWeek'
       },
       events: [{title: 'Consultation on the Preparation of the EU Adaptation Strategy', url: '/~sniffer/news-diary/calendar/consultation-on-the-preparation-of-the-eu-adaptation-strategy/', start: new Date('2012-07-03T00:00:00'), end: new Date('2012-08-20T00:00:00'), allDay: true, page_id: ''},{title: 'Festival of Politics', url: '/~sniffer/news-diary/calendar/festival-of-politics/', start: new Date('2012-08-18T00:00:00'), end: new Date('2012-08-24T00:00:00'), allDay: true, page_id: ''},{title: 'Consultation on Energy Efficiency Standard for Social Housing closing 28.09.12', url: '/~sniffer/news-diary/calendar/consultation-on-energy-efficiency-standard-for-social-housing-closing-28.09.12/', start: new Date('2012-06-25T00:00:00'), end: new Date('2012-06-25T00:00:00'), allDay: true, page_id: ''},{title: 'Consultation on efficient use of materials closing on 28.09.12', url: '/~sniffer/news-diary/calendar/consultation-on-efficient-use-of-materials-closing-on-28.09.12/', start: new Date('2012-06-27T00:00:00'), end: new Date('2012-06-27T00:00:00'), allDay: true, page_id: ''},{title: 'Launch of the latest Sustainable Consumption Institute (SCI) report', url: '/~sniffer/news-diary/calendar/launch-of-the-latest-sustainable-consumption-institute-sci-report/', start: new Date('2012-07-04T00:00:00'), end: new Date('2012-07-13T00:00:00'), allDay: true, page_id: ''},{title: 'Strathclyde Loch Restoration Phase 1', url: '/~sniffer/knowledge-hubs/resilient-catchments/river-restoration-partnerships/strathclyde-loch-restoration-phase-1/', start: new Date('2012-05-01T00:00:00'), allDay: true, page_id: '161'}],
       eventRender: function(event, element) {
           element.attr('rel', event.page_id);
       },
       timeFormat: 'H(:mm)',
       complete: function() {
           $('#calendar').css('background', 'none');
       }
   });

   // Append coloured pills to events
   function updateEventCats() {
        var colour;
        $('a.fc-event').each(function() {
            var rel = $(this).attr('rel');
            var ids = rel.split('-');

            for (var i=0; i<ids.length; i++) {
                colour = colours['+i+'];
                if (rel != '') {
                   $(this).find('.fc-event-inner').prepend('<div class=\'event-pill\' style=\'background:'+colours[ids[i]]+'\'></div>');
                }
            };
        });
   }

   updateEventCats();

   // Update pills on calendar paging
   $('.fc-button').click(function() {
        updateEventCats();
   });

});

似乎没有任何不必要的逗号,我也没有从 IE 的开发人员工具中得到任何脚本错误。我在 IE=edge 中运行,所以是 IE8 标准模式。否则日历可以完美呈现,页面没有任何问题。

我尝试禁用药丸的东西,以便日历呈现香草,但这没有帮助。

非常感谢任何建议。

【问题讨论】:

    标签: json fullcalendar


    【解决方案1】:

    将日期作为字符串而不是 Date 对象传递。喜欢:

    {
      title: 'Consultation on the Preparation of the EU Adaptation Strategy',
      url: '/~sniffer/news-diary/calendar/consultation-on-the-preparation-of-the-eu-daptation-strategy/',
      start: '2012-07-03T00:00:00',
      end: '2012-08-20T00:00:00',
      allDay: true,
      page_id: ''
    }
    

    我在 IE9 上使用 Browser Mode: IE8 and Document Mode: IE8 standards 对此进行了测试,它可以工作。

    希望这会有所帮助!

    【讨论】:

    • mmm.. 问题是如何以通常的方式进行,并且以这种方式,以便所有浏览器都理解它?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多