Reputation: 727
I want to show bootstrap tooltips over events in fullcalendar of Adam Shaw. I tried this code:
eventMouseover: function (event, jsEvent) {
$(this).tooltip();
$(this).css('rel', 'tooltip');
$(this).tooltip({
selector: '[rel=tooltip]'
});
},
But it does not work. What's wrong here?
Upvotes: 3
Views: 11032
Reputation: 9
My solution with Bootstrap and fullcalendar 5:
eventDidMount: function (info) {
$(info.el).popover({
animation: true,
delay: 300,
content: '<b>Title</b>:' + info.event.title + "</b>:",
trigger: 'hover'
});
},
Upvotes: 0
Reputation: 1407
For new version Full calendar version 5
document.addEventListener('DOMContentLoaded', function() {
var calendarEl = document.getElementById('calendar');
var calendar = new Calendar(calendarEl, {
plugins: [ momentPlugin, dayGridPlugin, timeGridPlugin, listPlugin, interactionPlugin ],
initialView: 'dayGridMonth',
themeSystem: 'bootstrap',
height: 600,
selectable:true,
editable:true,
headerToolbar: {
left: 'today,prev,next',
center: 'title',
right: 'dayGridMonth,timeGridWeek,timeGridDay'
},
eventClick: function(info) {
var eventObj = info.event;
console.log(eventObj.extendedProps.description);
},
eventDidMount: function(info) {
$(info.el).tooltip({
title: info.event.title,
});
},
events: '/url',
eventColor: '#378006',
});
calendar.render();
});
Upvotes: 6
Reputation: 300
In fullCalendar 4, I just replyed here: Tooltip in fullcalendar not working
use eventRender function:
eventRender: function (info) {
$(info.el).tooltip({ title: info.event.title });
}
Upvotes: 4
Reputation: 37
My solution is:
$('#calendar').fullCalendar({
...
events: [
{"title":"foo",
"description":"bar<br>baz",
"start":"2015-08-28 17:45:00",
"url":"foo"},
{ ...
}
],
eventMouseover: function(event, element) {
$(this).tooltip({title:event.description, html: true, container: "body"});
$(this).tooltip('show');
}
});
Upvotes: 3
Reputation: 301
You can shorten your answer a bit like this:
eventAfterRender: function (event, element) {
$(element).tooltip({title:event.title, container: "body"});
}
Upvotes: 11
Reputation: 727
I got it working:
eventRender: function (event, element) {
var tooltip = event.Description;
$(element).attr("data-original-title", tooltip)
$(element).tooltip({ container: "body"})
}
Upvotes: 7