I am utilizing the FullCalendar jQuery plugin within a web application framework plugin.
Additional CSS files such as fullcalendar.css are dynamically loaded in JavaScript:
$("<link rel='stylesheet' type='text/css' href='fullcalendar.css' />").appendTo("head");
When the fullcalendar.js renders and positions calendar events, there is an issue where the positions are calculated incorrectly if the fullcalendar.css file has not been loaded at that moment. This causes the events to be "moved" offscreen after the CSS loads.
To see a demonstration, visit this jsfiddle Demo.
How can I prevent this from happening? Could this be a problem with the FullCalendar plugin?
Edit: After some investigation, I discovered the $(window).load()
event. It appears that moving the JS call to initialize FullCalendar within this event resolves the issue. Is this a viable solution?