代码:http: //jsfiddle.net/AzmJv/1008/
popover
将鼠标悬停在日历中的事件上时,我正在尝试使用 Bootstrap Popover 插件进行创建。popover()
但是,在创建新事件 DOM 后,我找不到绑定到它的方法。
我尝试eventAfterRender
根据文档使用事件,但它似乎是为日历中的所有事件触发的。
http://fullcalendar.io/docs/event_rendering/
HTML:
<div id='calendar'></div>
JS:
$(document).ready(function () {
$('#calendar').fullCalendar({
header: {
left: 'prev,next today',
center: 'title',
right: 'month,agendaWeek,agendaDay'
},
defaultDate: '2015-02-12',
selectable: true,
selectHelper: true,
select: function (start, end) {
var title = prompt('Event Title:');
var eventData;
if (title) {
eventData = {
title: title,
start: start,
end: end
};
// console.log(eventData);
$('#calendar').fullCalendar('renderEvent', eventData, true); // stick? = true
}
$('#calendar').fullCalendar('unselect');
},
eventAfterRender: function (event, element, view) {
console.log('eventAfterRender');
console.log(event);
console.log(element);
console.log(view);
},
editable: true,
eventLimit: true, // allow "more" link when too many events
events: [{
title: 'All Day Event',
start: '2015-02-01'
}, {
title: 'Long Event',
start: '2015-02-07',
end: '2015-02-10'
}, {
id: 999,
title: 'Repeating Event',
start: '2015-02-09T16:00:00'
}, {
id: 999,
title: 'Repeating Event',
start: '2015-02-16T16:00:00'
}, {
title: 'Conference',
start: '2015-02-11',
end: '2015-02-13'
}, {
title: 'Meeting',
start: '2015-02-12T10:30:00',
end: '2015-02-12T12:30:00'
}, {
title: 'Lunch',
start: '2015-02-12T12:00:00'
}, {
title: 'Meeting',
start: '2015-02-12T14:30:00'
}, {
title: 'Happy Hour',
start: '2015-02-12T17:30:00'
}, {
title: 'Dinner',
start: '2015-02-12T20:00:00'
}, {
title: 'Birthday Party',
start: '2015-02-13T07:00:00'
}, {
title: 'Click for Google',
url: 'http://google.com/',
start: '2015-02-28'
}]
});
});
CSS:
body {
margin: 40px 10px;
padding: 0;
font-family:"Lucida Grande", Helvetica, Arial, Verdana, sans-serif;
font-size: 14px;
}
#calendar {
max-width: 900px;
margin: 0 auto;
}
您可以在控制台中看到日志,显示每次通过单击日期创建新事件时,它都会通过调用来循环所有现有事件eventAfterRender
。
所以问题:
创建新事件后如何触发一次?
如何将该事件DOM与属性绑定
popover
并具有额外的数据(如description
键)?我不想只查询 DOM 来显示标题。
谢谢。