简体   繁体   English

fullcalendar 中的工具提示不起作用

[英]Tooltip in fullcalendar not working

everyone!每个人! I'm trying to show tooltip over events in fullcalendar.我正在尝试在 fullcalendar 中显示事件的工具提示。 But it's not working and show in console this message但它不起作用并在控制台中显示此消息

Uncaught SyntaxError: Unexpected token (未捕获的语法错误:意外的标记 (

What can be a problem?有什么问题? This is my js-function code:这是我的 js 函数代码:

$('#calendar').fullCalendar(function() {
    eventAfterRender: function(event, element) {
        $(element).tooltip({
            title: event.title,
            container: "body"
        });
    }
});

In FullCalendar 4, use eventRender function:在 FullCalendar 4 中,使用 eventRender 函数:

eventRender: function (info) {
  $(info.el).tooltip({ title: info.event.title });     
}

You are passing function.你正在传递函数。 You should pass your options and callbacks.您应该传递您的选项和回调。 Read Docs阅读文档

$('#calendar').fullCalendar({   //Removed function() from here
    eventAfterRender: function(event, element) {
        $(element).tooltip({
            title: event.title,
            container: "body"
        });
    }
});

as documentation say. 如文档所述。

eventRender: function(info) {
    var tooltip = new Tooltip(info.el, {
      title: info.event.extendedProps.description,
      placement: 'top',
      trigger: 'hover',
      container: 'body'
    });
  }

don't forget to import popper.js 不要忘记导入popper.js

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM