jQuery fullcalendar adds weird hr at the end of the calendar when using minTime and maxTime

妖精的绣舞 提交于 2020-01-07 04:24:06

问题


This is what I'm talking about:

And this is what I expect:

The minimal settings to replicate this are:

$('#calendar').fullCalendar({
    defaultView: 'agendaWeek',           
    minTime: '10:00',
    maxTime: '16:00'         
});

You can play with it in this jsbin.

Removing either minTime or maxTime makes the calendar behave as expected.


回答1:


After some fiddling, it appears that the default aspect ratio is 1.35. Because your calendar doesn't meet that ratio, it is adding padding.

There are 2 options that I can see that would fix it.

(1) Modify the aspect ratio. In your example a ratio of 2.2 might work:

$('#calendar').fullCalendar({
    defaultView: 'agendaWeek',
    allDaySlot: false,            
    minTime: '10:00',
    maxTime: '16:00',
    aspectRatio: 2.2
});

(2) Set height to auto. This will make the calendar the natural height, but it will not allow for scrollbars:

$('#calendar').fullCalendar({
    defaultView: 'agendaWeek',
    allDaySlot: false,            
    minTime: '10:00',
    maxTime: '16:00',
    height: 'auto'
});


来源:https://stackoverflow.com/questions/28048236/jquery-fullcalendar-adds-weird-hr-at-the-end-of-the-calendar-when-using-mintime

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!