JavaScript FullCalendar
Introduction
Sometimes, we would like to show a calendar in our web application. In this blog post, I would like to discuss how to integrate a JavaScript based calendar plugin FullCalendar into our website.
FullCalendar
FullCalendar is one of the most popular JavaScript calendar plugins available. It comes with a free version and a paid version. We would just use the free version for our website.
Example
The FullCalendar integrated into my website looks like this. It is not perfect, but it should be quite sufficient for multiple use cases.
Implementation
The implementation of a calendar using FullCalendar, extended from one of the official examples, can be as simple as follows.
1 |
|
However, when I tried to integrate it into my website, I found that because the FullCalendar heavily relies on the external CSS for formatting and there are lots of CSS overridden from my website, both the entire webpage and the calendar got screwed up.
Downloading the external CSS and modifying it requires reading and understanding the JavaScript source code, which is something I don’t have the bandwidth to do. So my ultimate strategy is to use the iframe
tag for integration since the content from the iframe
will not be affected the CSS of the target.
The integration code looks as follows.
1 | <div style="overflow-x:auto;"> |
Because the responsive design of FullCalendar does not work well with small screens, I used fixed width and heigh and allowed overflow for the calendar.
References
JavaScript FullCalendar