How can I automatically set FullCalendar to the specified div space

I want to put fullCalendar in the specified div field, giving it a liquid effect, but it's hard to do. I even tried using the aspect ratio, but not getting any luck .... below, what I have done so far

    $(window).resize(function() {
    var ratio = $(window).width()/$(window).height();
    $('.resize').html('<div>ratio:'+ratio+'</div>');
    calendar.fullCalendar('option', 'aspectRatio', ratio);
});
+5
source share
2 answers

Dynamically changed height , not aspect ratio :

Assigning a calendar variable at startup:

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

And then dynamically changing the height (after checking that the calendar already exists to avoid the appearance of the initial error messages):

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

The factor *0.83depends on your page design.

Hope this helps. English, weekview Spanish dayview

+8

All Articles