我正在尝试侦听日历初始化之外的事件丢弃。换句话说,我试图在初始化代码之外使用 eventDrop 函数。
$('#calendar').fullCalendar({
editable: true,
droppable: true,
eventDrop: function(calEvent, delta, revertFunc, jsEvent, ui, view ) {
alert("Event Dropped!");
eventlocations.push({
location: calEvent.location,
stopover: true
});
}
});
每次删除事件时,我想从 Google Maps API 运行函数 calculateAndDisplayRoute 的原因。
function initMap() {
var directionsService = new google.maps.DirectionsService;
var directionsDisplay = new google.maps.DirectionsRenderer;
var map = new google.maps.Map(document.getElementById('map'), {
zoom: 7,
center: destinationLatLng
});
directionsDisplay.setMap(map);
$('#calendar').on("drop",function(event, ui){//This does not work
alert("Dropped!");
calculateAndDisplayRoute(directionsService, directionsDisplay);
});
}
我尝试使用 jQueryUI 方法 on("drop") 但是,当我删除事件时,该事件不会触发。是不是初始化的 fullCalendar 元素不被识别为 jQueryUI droppable?
我在这里束手无策。如果您看到更好的方法,请提供帮助。
谢谢!