fullcalendar - display half-day event in the month view

徘徊边缘 提交于 2019-12-08 16:51:54

问题


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?


回答1:


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 :-)



来源:https://stackoverflow.com/questions/3382530/fullcalendar-display-half-day-event-in-the-month-view

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!