在加载FullCalendar之前获取所有GoogleCalendar事件

时间:2013-11-25 19:10:39

标签: fullcalendar google-calendar-api load-time

我目前正在使用Adam Shaw的jQuery Calendar' FullCalendar'并且我在日历渲染中遇到了重大延迟。简而言之,页面出现,1秒钟过去,日历弹出,另一秒钟过去,然后事件填充页面here。有没有办法只在今天的日期之前和之前获取一定数量的事件?或者甚至立即加载日历将是一种改进。我也在使用Craig Thompson的qTip2。

的Javascript

<script type=text/javascript>
// Setup FullCalendar
jQuery(document).ready
(function() {
var date = new Date();
var d = date.getDate();
var m = date.getMonth();
var y = date.getFullYear();

var tooltip = $('<div/>').qtip({
    id: 'fullcalendar',
    prerender: true,
    content: {
        text: ' ',
        title: {
        },
    },
    events: {
        render: function(event, api) {
            var elem = api.elements.bgiframe;
        }
    },
    position: {
        my: 'bottom center',
        at: 'top center',
        target: 'event',
        viewport: $(window),
        adjust: {
            mouse: false,
            scroll: true,
            method: 'shift',
            resize: true
        }
    },
    show: {
        modal: {
            on: false,
            blur: true,
            stealfocus: false
            }
        },
    hide: false,
    style: 'qtip-bootstrap'
}).qtip('api');

$('#fullcalendar').fullCalendar({

    eventSources: ["https://www.google.com/calendar/feeds/emailaddresshere/public/basic",
        "http://www.google.com/calendar/feeds/usa__en%40holiday.calendar.google.com/public/basic"],

    header: {
        left: 'title',
        center: '',
        right: 'today prev,next'
    },

    selectable: true,
    eventClick: function(data, event, view) {
        var content = '<h3>'+data.title+'</h3>' + 
            '<p><b>Start:</b> '+data.start+'<br />' + 
            (data.end && '<p><b>End:</b> '+data.end+'</p>' || '');

        tooltip.set({
            'content.text': content
        })
        .reposition(event).show(event);
    },
    dayClick: function() { tooltip.hide() },
    eventResizeStart: true,
    eventDragStart: false,
    viewDisplay: function() { tooltip.hide() }

});
}());
</script>

0 个答案:

没有答案