问题
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?
回答1:
You can shorten your answer a bit like this:
eventAfterRender: function (event, element) {
$(element).tooltip({title:event.title, container: "body"});
}
回答2:
I got it working:
eventRender: function (event, element) {
var tooltip = event.Description;
$(element).attr("data-original-title", tooltip)
$(element).tooltip({ container: "body"})
}
回答3:
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');
}
});
回答4:
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 });
}
来源:https://stackoverflow.com/questions/18633687/twitter-bootstrap-tooltips-do-not-work-for-events-in-fullcalendar