将函数名称作为eventMouseover回调传递

时间:2015-06-04 16:20:24

标签: fullcalendar

我正在尝试将函数的实际名称而不是匿名函数传递给我的FullCalendar初始化,如下所示:

$('#gcally_calendar').fullCalendar({
    "eventSources":    
        [...],
    "eventMouseover":"fc_hover_in"
});

我这样做时遇到控制台错误,但是:Uncaught TypeError: Array.prototype.slice.call is not a function

对此有何想法?

为了彻底,这是功能:

function fc_hover_in(calEvent, jsEvent, view) {
var tooltip = '<div class="tooltipevent" style="width:100px;height:100px;background:#ccc;position:absolute;z-index:10001;">' + calEvent.title + '</div>';
jQuery("body").append(tooltip);
jQuery(this).mouseover(function(e) {
    $(this).css('z-index', 10000);
    $('.tooltipevent').fadeIn('500');
    $('.tooltipevent').fadeTo('10', 1.9);
}).mousemove(function(e) {
    $('.tooltipevent').css('top', e.pageY + 10);
    $('.tooltipevent').css('left', e.pageX + 20);
});
}

但此时甚至没有被召唤。

1 个答案:

答案 0 :(得分:0)

您应该删除引号以将该函数作为参考传递 这样:

"eventMouseover":"fc_hover_in"

成为这个:

"eventMouseover": fc_hover_in