javascript – fullcalendar – 调整窗口大小的日历大小

前端之家收集整理的这篇文章主要介绍了javascript – fullcalendar – 调整窗口大小的日历大小前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我正在使用fullcalendar( fullcalendar by adam shaw)

我想知道我需要做什么,以便我的fullcalendar根据浏览器窗口的大小动态更改大小?我已经看了他的“渲染”功能了一点,但一直在弄清楚这一点.

(即,当用户调整窗口大小时,我希望fullcalendar将其宽度和高度重新调整为适当的宽高比)

解决方法

这一切都记录在案.

我们来看看,尝试一下这样的事情:

//function to calculate window height
function get_calendar_height() {
      return $(window).height() - 30;
}

//attacht resize event to window and set fullcalendar height property
$(document).ready(function() {
    $(window).resize(function() {
        $('#calendar').fullCalendar('option','height',get_calendar_height());
    });


    //set fullcalendar height property
    $('#calendar').fullCalendar({   
            //options
            height: get_calendar_height
    });
});

应用类似于宽度.或者您可以将日历放在div中,并以这种方式进行操作.

原文链接:https://www.f2er.com/js/154865.html

猜你在找的JavaScript相关文章