Fullcalendar:Fullcalendar.io dayClick和fc-more

时间:2016-05-30 18:04:32

标签: fullcalendar

我一直试图弄清楚如何触发“点击”。通过单击fc-day元素在fc-more元素中执行操作。

我认为最好的方法是在日历选项中使用dayClick,同时对其进行初始化。问题是如何找到该元素?,然后单击它。我不知道生成的' id'对于它,但课程是" fc-more。"

任何建议都值得赞赏!

1 个答案:

答案 0 :(得分:0)

  

可能,您需要破解 fullcalendar.js

找到以setElement: function(el) {开头的函数。 在FullCalendar v2.5.0中它位于评论

下方的第3175行
// Sets the container element that the grid should render inside of.
// Does other DOM-related initializations.

你需要在这个函数中添加else条件,如下所示

    el.on('mousedown', function(ev) {
                if (
                    !$(ev.target).is('.fc-event-container *, .fc-more') && // not an an event element, or "more.." link
                    !$(ev.target).closest('.fc-popover').length // not on a popover (like the "more.." events one)
                ) {
                    _this.dayMousedown(ev);
                }else{
                    alert('you clicked more');
                }
            });

你也可以在其他地方添加这一行,以检查它是否只是

if ($(ev.target).is('.fc-event-container *, .fc-more') )
相关问题