2017-06-15 45 views
0

我在fullcalendar上使用「listMonth」視圖。當我在正常的議程中放置外部事件時,會觸發事件'drop'和'eventReceive',但是當我在listview上放置一個事件時,它不會觸發這些事件。有沒有辦法實現這一點?Fullcalendar - 在列表視圖上拖放事件

+0

不,因爲它只是事件列表,而不是網格。在拖動任何事件的事件之間沒有空閒空間。爲此使用議程或基本視圖。 – ADyson

+0

這麼認爲,謝謝你的快速反應。 –

回答

0

可能不會有助於獲取有用的數據,但如果您正在尋找一種方法來檢測某個項目是否已放置在日曆上,則可以使用jQuery可停止停止功能。

$(".item").draggable({ 
    //other details 
    stop:function(event, ui){ 
     //get a reference to the calendar 
     var calendar = $("#calendar"); 

     //get bounds 
     var bounds = [ 
      left:calendar.offset().left, 
      top:calendar.offset().top, 
      width:calendar.width(), 
      height:calendar.height() 
     ]; 

     //get coordinates 
     var x = event.pageX; 
     var y = event.pageY; 

     //check if in bounds 
     if (
     x >= bounds.left && 
     x <= bounds.left + bounds.width && 
     y >= bounds.top && 
     y <= bounds.top + bounds.height 
     ){ 
      //item has been dropped within 
     } 
    } 
}); 

不幸的是,jQuery沒有確定您將它放到的項目的方法。

+0

感謝您的信息! –