FullCalendar:如何使用功能DayRender在每月的每一天显示图标? [英] FullCalendar: How can i display an icon on each day of the month using the function DayRender?
本文介绍了FullCalendar:如何使用功能DayRender在每月的每一天显示图标?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在通过 FullCalendar 建立日历.
我想在当前月份的每一天显示一个小图标img.不管发生什么事情. (让我说我根本没有任何事件). 我想使用DayRender函数.可能的话
I would like to display a small icon img for each day of the the current month. regardlees to any events. (lets say i dont have events at all). i would like to use the DayRender function. if that possible
这是到目前为止我的日历的实现:
here is the impletetion of my calendar so far:
$(document).ready(function() {
var json_backgrundColor ={"1":"#f1f9ef","2":"#edf5f9","3":"#edf5f9","4":"#f7fafc","5":"#f7fafc","6":"#f7fafc","7":"#f7fafc","8":"#f7fafc","9":"#edf5f9","10":"#edf5f9","11":"#f7fafc","12":"#f7fafc","13":"#f7fafc","14":"#f7fafc","15":"#f7fafc","16":"#edf5f9","17":"#edf5f9","18":"#f7fafc","19":"#f7fafc","20":"#f7fafc","21":"#f7fafc","22":"#f7fafc","23":"#edf5f9","24":"#f1f9ef","25":"#ffdfdf","26":"#ffdfdf","27":"#f1f9ef","28":"#f1f9ef","29":"#f1f9ef","30":"#f1f9ef","31":"#f1f9ef"};
$('#calendar').fullCalendar({
header: {
left: 'prev,next today',
center: 'title',
},
defaultView: 'month',
dayRender: function ( date, cell) {
var cellDate = date.format('D');
if(!cell.hasClass('fc-other-month')) {
cell.css('background-color', json_backgrundColor[cellDate]);
}else {
cell.css('background-color', '#ffffff');
}
},
});
});
https://jsfiddle.net/m53jbwx0/4/
有人知道我该怎么做吗?
anyone know how can i do that?
非常感谢!
推荐答案
您需要这样的东西吗?
Do you need something like this?
dayRender: function ( date, cell) {
cell.prepend('<i class="fa fa-plane" aria-hidden="true"></i>');
}
最诚挚的问候
Krzysztof
Best regards
Krzysztof
这篇关于FullCalendar:如何使用功能DayRender在每月的每一天显示图标?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文