好的,所以在插件初始化后尝试设置其值为回调函数的选项时,我遇到了问题。我认为这将是一种常见的行为,在初始化日历后动态设置事件回调。
这是一段代码:
$(文档).ready(函数() { $('#calendar').fullCalendar({ 可编辑:假 ,events:[{"title":"meeting.title","start":"2010-05-21 15:58:16 UTC"},{"title":"meeting.title","start":" 2010-05-24 15:58:16", "url":"http://google.com"}] /* ,eventClick: function(event) { 如果(事件.url){ window.open(event.url); 返回假; } } */ }); $('#calendar').fullCalendar('option', 'eventClick', function(event) { 如果(事件.url){ window.open(event.url); 返回假; } }); });
您可以看到将 eventClick 函数设置为注释掉的 init 选项。如果我这样做,它工作正常。但是,如果我尝试在初始化之后设置它,它就不起作用:(
有其他方法可以做到这一点吗?或者我是否坚持必须预先设置行为?