Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

FullCalendar auto-height in week view

Tags:

fullcalendar

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 height: auto, aspectRation: 1.35, I see a vertical scrollbar: enter image description here

If I change aspectRatio to 1, scrollbar disappears but I see a useless empty area at the bottom:

enter image description here

Is there any way to fix it except guessing the aspectRatio (which is not a case for me as minTime and maxTime are dynamically changed so the conent height changes)?

like image 537
SiberianGuy Avatar asked Oct 12 '14 19:10

SiberianGuy


2 Answers

Edit:

Fullcalendar v2.1.1

http://jsfiddle.net/3E8nk/560/

contentHeight: 'auto',

Solution for old versions?

Kind of hack:ish. Does this work in your environment? I used the code from your other question.

http://jsfiddle.net/3E8nk/558/

contentHeight: '9999',
like image 77
Richard Löwenström Avatar answered Sep 18 '22 23:09

Richard Löwenström


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. Adam Shaw's fullcalendar at 100% height and scrollbars

Day view, spanish (as fullcalendar is multilingual - lol

like image 43
Jürgen Fink Avatar answered Sep 17 '22 23:09

Jürgen Fink