FullCalendar auto-height in week view

前端 未结 3 1491
予麋鹿
予麋鹿 2021-01-07 22:45

I need to have a calendar in week mode which would take all the width it can take and take all the height it needs to not have scrollbars.

If I keep default settings

3条回答
  •  甜味超标
    2021-01-07 23:25

    Adjusting dynamically the height instead of the aspect ratio worked for me:

    Asigning the calendar to a variable when initiating:

    calendar = $('#calendar').fullCalendar({
        height: $(window).height()*0.83,
        ...
    });
    

    And then adjusting height dynamically (after checking that calendar exists already in order to avoid initial error messages):

    if(calendar) {
      $(window).resize(function() {
        var calHeight = $(window).height()*0.83;
        $('#calendar').fullCalendar('option', 'height', calHeight);
      });
    };
    

    The factor *0.83 depends on your page-design.

    Hope this helps.

提交回复
热议问题