2012-07-06 68 views
0

這是其他人所遇到的問題,但其他地方列出的解決方案都不適用於我。我正在使用FullCalendar 1.5.3縮小版(儘管有趣的是非縮小版本在某種程度上是不同的 - 它並不稱爲我的完整功能,儘管如此,這是一個不同的故事)。IE8中的FullCalendar - 事件不會呈現

這裏是我的生成的JavaScript/JSON(從DB輸出):

$(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 =邊緣運行,所以IE8標準模式。日曆完全呈現,頁面沒有任何問題。

我試過禁用藥丸的東西,所以日曆呈現香草,但沒有幫助。

任何建議非常感謝。

回答

3

將日期傳遞爲字符串而不是日期對象。像:

{ 
    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測試了它,它工作。

希望這會有所幫助!

+0

現貨,謝謝! – melat0nin 2012-07-07 10:08:59

+0

嗯..問題是如何以通常的方式做到這一點,並以這種方式讓所有的瀏覽器都明白這一點? – kneidels 2013-06-18 08:01:27