0

I currently am using Adam Shaw's jQuery Calendar 'FullCalendar' and am experiencing significant delays in the calendar rendering. In short, the page appears, 1 second passes, the Calendar pops in, another second passes, and then the events populate the page, here. Is there a way to only fetch a certain number of events behind and before today's date? Or even loading the calendar immediately would be an improvement. I am also using Craig Thompson's 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>
mijopabe
  • 646
  • 5
  • 23
  • It seems you cant control that since you getting the events from a google url. Can´t you pre-load the google calendar events server side first? And after that load them directly from serveR? – Henrique C. Nov 26 '13 at 09:10
  • Interesting perspective.... I will have to consult my school for this as the page runs on their servers but this should work in theory. Great idea! So far I have consolidated files for fewer HTTP requests and enabled caching while using .js?versionnumber to speed this up as much as possible. Event rendering, however, is a whole other beast. I will update this with results next week. Have a Happy Thanksgiving! – mijopabe Nov 27 '13 at 07:37
  • I'm glad to help :) ! Have a Happy Thanksgiving! – Henrique C. Nov 27 '13 at 09:03

0 Answers0