Search code examples
jqueryjquery-pluginsfullcalendarfullcalendar-2

How to set Month View in Full Calendar to expand only if there is a event?


I have Customised the FullCalendar plugin little bit for a project of mine, it looks like this - month view. As you can see the empty date has the same height of the date's with the Events. what I want is that the week of the month view without any event day should be small. I have set the height of the days using aspect ratio now. Please do guide me. Thank you cheers...


Solution

  • Here is the answer that worked for me special thanks for @Adyson for the help and suggestions.

    var calHeight = function() {
        $('#calendar').find('.fc-row').each(function() {
            var ogHeigth = '';
                if ($(this).find('.fc-event-container').length > '0') {
                    ogHeigth = $(this).outerHeight();
                }
                if ($(this).find('.fc-event-container').length == '0') {
                    $(this).css('height', ogHeigth - ogHeigth / 3);
                }
        });
    }
    

    I put this function in all functions inside the full calendar , so that this runs whenever an event is added, updated or deleted, the date is changed etc. its working for me hope this helps you guys to. ty