[英]How to make jQuery FullCalendar's height fit its content?
有一個getView
方法返回當前活動的View。 而且這個View
有自己的方法setHeight
,所以你可以創建一個這樣的函數:
function resizeCalendar(calendarView) {
if(calendarView.name === 'agendaWeek' || calendarView.name === 'agendaDay') {
// if height is too big for these views, then scrollbars will be hidden
calendarView.setHeight(9999);
}
}
並在視圖更改時調用它:
$('#calendar').fullCalendar({
viewDisplay: resizeCalendar,
...
});
工作JSFiddle
在2.1.0版中,您可以使用height
或contentHeight
選項並將其值設置為auto
。
height
選項指整個日歷的高度(包括標題)。 contentHeight
選項引用日歷的內容區域高度。
根據插件的文檔 , auto
的值意味着視圖的內容將采用自然高度,並且不會使用滾動條。
按如下方式初始化日歷:
$('#calendar').fullCalendar({
contentHeight: "auto",
// .... other options here
});
在這里小提琴: https : //jsfiddle.net/yj90oqzf/
更多信息:
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.