FullCalendar js – 在所有日期单元格中添加代码html II

昨天,我发布了一个问题,但必要条件已经改变: 对fullCalendar js的DOM操作 。

现在,图标必须是事件。 你无法添加图标库“awesome”

从这个例子(代码js)

$(document).ready(function() { var date = new Date(); var d = date.getDate(); var m = date.getMonth(); var y = date.getFullYear(); var events_array = []; var currDate = new Date(new Date().getFullYear(), 0, 1); while (currDate.getYear() == 115) { currDate.setDate(currDate.getDate() + 1); var myDate = new Date(currDate); events_array.push({ title: '2\n3\n1\n1\n1', start: myDate }) } $("#calendar").fullCalendar({ header: { left: 'prev', center: 'title', right: 'next' }, selectable: false, monthNames: ['Enero', 'Febrero', 'Marzo', 'Abril', 'Mayo', 'Junio', 'Julio', 'Agosto', 'Septiembre', 'Octubre', 'Noviembre', 'Diciembre'], dayNamesShort: ['D', 'L', 'M', 'M', 'J', 'V', 'S'], editable: false, eventLimit: true, // allow "more" link when too many events eventRender: function(event, element) { /*element.find(".fc-time").after($("").html("
    " + "
  • " + "
  • " + "
  • " + "
  • " + "
  • " + "
")); When activing this code, the event not is visible. i know that i must not to use the ".fc-time" class. But i have tested with others and nothing (fc-event-container). */ }, eventClick: function(event, element) { alert("Clic Event"); }, events: events_array }); });:

从这个例子(代码css)

 .fc-event { top: 10px; margin-left: 20px; width: auto !important; background: transparent; border: 0px solid #3a87ad; color: #000; } .fc-time{ display: none; } 

简而言之,我需要在所有日历的所有单元格中进行两个事件,即此forms:

在此处输入图像描述

在eventRender中我有一个注释代码,关于图标,也许它可能是一个线索。

谢谢,

您可以使用eventRender事件将图标添加到dom,并使用事件文本浮动图标集:

 eventRender: function (event, element) { element.find('.fc-event-inner').before($("
").html("
    " + "
  • " + "
  • " + "
")); },

和一点造型:

 .fc-event { top: 10px; background: transparent; border: 0px solid #3a87ad; color: #000; } .fc-event-icons { float: left; margin-right: 5px; } .fc-event-inner { width: 20px; } 

结果: 在此处输入图像描述

演示: http : //jsfiddle.net/dcx5unzd/4/