簡體   English   中英

fullcalendar 中的工具提示不起作用

[英]Tooltip in fullcalendar not working

每個人! 我正在嘗試在 fullcalendar 中顯示事件的工具提示。 但它不起作用並在控制台中顯示此消息

未捕獲的語法錯誤:意外的標記 (

有什么問題? 這是我的 js 函數代碼:

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

在 FullCalendar 4 中,使用 eventRender 函數:

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

你正在傳遞函數。 您應該傳遞您的選項和回調。 閱讀文檔

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

如文檔所述。

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

不要忘記導入popper.js

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM