我正在尝试为标题中的下拉(或悬停)菜单添加一个图像,其中包含FullCalendar周视图中的日期名称。像这样http://img29.imageshack.us/img29/7440/nbf.png
这是我试图追加DIV但到目前为止没有运气的地方。
<th class="fc-day-header fc-tue fc-widget-header" style="width: 233px;">Tir 6/8</th>
到目前为止,我试图用一些文字附加一个div,看看它到底在哪里:
$(".fc-mon").prepend("<div style='position:relative;top:0px;left:0px'>[||]</div>");
但这绝对不是一个成功! http://img14.imageshack.us/img14/7070/5y1l.png
任何意见都将不胜感激:)
答案 0 :(得分:0)
我认为您需要使您的选择器更具体,如$('.fc-widget-header.fc-mon')
,以便只捕获标题。
我得到了以下代码:
var $calendar = $('#calendar').fullCalendar({
viewDisplay: function (view) {
// Clean up any previously added "dropdowns"
$('.dropdown').remove();
// Only add "drowdowns" if the current view is the weekly view
if (view.name === 'agendaWeek') {
// Add the "dropdowns" to the day headers
$('.fc-widget-header.fc-sun, .fc-widget-header.fc-mon, .fc-widget-header.fc-tue, .fc-widget-header.fc-wed, .fc-widget-header.fc-thu, .fc-widget-header.fc-fri, .fc-widget-header.fc-sat')
.prepend("<div class='dropdown' style='display: inline'>[||] </div>");
}
}
});
您可以查看此jsfiddle以获取一个工作示例:http://jsfiddle.net/kvakulo/p5f3J/3/