fullcalendar - 在月视图中显示半天活动 [英] fullcalendar - display half-day event in the month view
本文介绍了fullcalendar - 在月视图中显示半天活动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
你如何在月视图中显示半日活动?例如,我有一个12小时的事件。我希望该事件的日期单元格只显示一个半栏。那可能吗?如果是这样,你如何实现这一点?
解决方案
所以事件定位为绝对,这是一个棘手的问题.. ...
使用eventAfterRender回调如下所示:
,eventAfterRender:函数(事件,元素,视图){
/ **
*获取日历表中第一天的位置宽度
*位于事件容器div旁边
* /
var containerWidth = jQuery(element).offsetParent()
.siblings(table)。find(。fc-day-content)。width();
//半天
var elementWidth = parseInt(containerWidth / 2);
//设置元素的宽度
jQuery(元素).css('width',elementWidth +px);
}
当然可以改进: - )
How do you display a half-day event in the month view? For instance, I have an event that is 12 hours long. I would like the date cell for that event to only show a half bar. Is that possible? If so, how do you implement this?
解决方案
So the events are positioned "absolute", this is a tricky one .....
Use of the eventAfterRender callback like this :
, eventAfterRender: function(event, element, view) {
/**
* get the width of first day slot in calendar table
* next to event container div
*/
var containerWidth = jQuery(element).offsetParent()
.siblings("table").find(".fc-day-content").width();
// half a day
var elementWidth = parseInt(containerWidth / 2);
// set width of element
jQuery(element).css('width', elementWidth + "px");
}
Surely can be improved :-)
这篇关于fullcalendar - 在月视图中显示半天活动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文