You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Fullcalendar 2.3.1日程视图如何隐藏17:00之后的显示区域?

解决Fullcalendar 2.3.1 Agenda视图(日/周)隐藏minTime-maxTime外底部区域的问题

1. 补充配置项,减少默认额外空间

在Fullcalendar初始化时添加allDaySlot: false,关闭全天事件槽,避免这部分占据底部冗余空间:

$('#calendar').fullCalendar({
    defaultView: 'agendaWeek',
    minTime: '08:00:00',
    maxTime: '17:00:00',
    allDaySlot: false, // 隐藏全天事件槽,消除额外空白
    slotDuration: '00:30:00', // 可选,根据需求设置时间间隔
    // 其他原有配置...
});

2. 用CSS精准隐藏底部空白区域

针对2.3.1版本的DOM结构,添加以下CSS规则,直接隐藏maxTime之后的时间槽、分隔线及空白区域:

/* 隐藏maxTime之后的最后一行时间槽 */
.fc-agenda-view .fc-slats tr:last-child {
    display: none;
}

/* 移除时间网格容器的固定高度,避免强制留白 */
.fc-agenda-view .fc-time-grid {
    height: auto !important;
}

/* 隐藏底部的双横线分隔符 */
.fc-agenda-view .fc-divider:last-of-type {
    display: none;
}

/* 隐藏内容骨架的最后一行空白 */
.fc-agenda-view .fc-content-skeleton tr:last-child {
    display: none;
}

说明

Fullcalendar 2.3.1仅通过minTime和maxTime无法完全移除底部空白,因为框架默认会保留一小段槽位用于兼容事件溢出场景。结合上述配置和CSS,就能彻底隐藏17:00之后的所有多余区域。

内容的提问来源于stack exchange,提问作者user3176995

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.08 01:38:18