FullCalendar: Get time by hovering over time slots
How do I get the time a time slot开发者_高级运维 actually hovered?
found a solution:
this option in fullcalendar works for me
viewDisplay: function( view ) {
$('.fc-minor').mouseenter(
function() { $('#myTime').html($(this).children('th').html());
});
}
I'm targeting the "data-date" attribute for each cell with the following in my vue project using the vue component for this library using the latest version 5.8.0 at the time of this comment. You can do something similar with your calendar object when you do a mouseover on it and then use the date value (first converting to your time format using something like moment.js) in a tooltip or displayed anywhere on your page.
<full-calendar
@click.prevent=""
:options="calendarOptions"
ref="calendar"
@mouseover="getCalendarTimestamp"
></full-calendar>
getCalendarTimestamp(e) {
if (e.srcElement.attributes[1] && e.srcElement.attributes[1] != undefined
) {
console.log(e.srcElement.attributes[1].value);
} else {
console.log("not a date value");
}
}
精彩评论