当事件的渲染选项等于背景时,Fullcalendar工具提示无法正常工作

时间:2019-10-23 15:20:21

标签: javascript date fullcalendar fullcalendar-4

我正在尝试使用Fullcalendar 4.3.1在后台显示假期,而其他事件则在同一日期显示。我的目标是当用户将鼠标悬停在几天上时,我会通过工具提示显示假期名称,而背景为另一种颜色,并且可以添加其他事件。

Antonio Santise's answer用于显示工具提示,但是,当我将事件的渲染选项设置为“背景”时,仅显示最后一个事件的工具提示。有人可以帮我避免这种行为并显示所有事件的工具提示吗?

我的代码:

  • 使用Laravel模型获取数据
public function index() {
    $eventos = EventoCalendario::selectRaw('id, \'true\' as allDay, title, data as start, data as end, color, is_facultativo, \'background\' as rendering')
                        ->orderBy('data')
                        ->get();

    return view('eventoscalendario.index', compact('eventos'));
}
  • 全日历的选项
events: {!! $eventos !!},
eventRender: function(info) {
   $(info.el).tooltip({
          title: info.event.title,
          html: true
   });
}

谢谢!

1 个答案:

答案 0 :(得分:1)

全日历团队提供了解决上述问题的“骨架”。但是,他们仍在努力在下一个版本中解决此问题。

Click here to check the issue #5110 in Fullcalendar's repo

解决方案:

只需在页面中插入下面的CSS代码即可。

.fc-bgevent-skeleton {
  pointer-events: none;
}
.fc-bgevent-skeleton .fc-bgevent {
  pointer-events: auto;
}
.fc-content-skeleton {
  pointer-events: none;
}
.fc-content-skeleton .fc-event {
  pointer-events: auto;
}