Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

fullcalendar - display half-day event in the month view

Tags:

fullcalendar

How do you display a half-day event in the month view? For instance, I have an event that is 12 hours long. I would like the date cell for that event to only show a half bar. Is that possible? If so, how do you implement this?

like image 542
thd Avatar asked Aug 01 '10 15:08

thd


People also ask

What is FullCalendar in PHP?

The FullCalendar library allows the user to drag and drop event instances from one date to another. It also supports event resizing to extend or change event duration. This screenshot shows the output of the PHP calendar event management example by integrating FullCalendar library.

Can background events that are all-day be rendered in month view?

Background events that are all-day will only be rendered in month view or the all-day slots of TimeGrid view.

What's new in FullCalendar view processor?

Automatically load third party library from CDN if local host library is missing. Introduce a new plugin type of 'Fullcalendar View Processor' which allow other modules to alter all properties of the Fullcalendar without hacking the JS from this module. Support Ajax filter.

What is the difference between form based event management and calendar view?

In the form based event management, the user has to enter more data like event title, from-date to-date and more. But in calendar view management user can give only the title by selecting the date. It will facilitate the user to quickly manage his day to day events.


1 Answers

So the events are positioned "absolute", this is a tricky one .....

Use of the eventAfterRender callback like this :

    , eventAfterRender: function(event, element, view) {
        /**
         * get the width of first day slot in calendar table
         * next to event container div
         */
        var containerWidth = jQuery(element).offsetParent()
                             .siblings("table").find(".fc-day-content").width();

        // half a day
        var elementWidth = parseInt(containerWidth / 2);

        // set width of element
        jQuery(element).css('width', elementWidth + "px");
    }

Surely can be improved :-)

like image 160
domi27 Avatar answered Sep 17 '22 05:09

domi27