【问题标题】:Fullcalendar - drop event on listviewFullcalendar - 在列表视图上放置事件
【发布时间】:2017-06-15 11:35:15
【问题描述】:

我在完整日历上使用“listMonth”视图。当我在正常议程上放置一个外部事件时,会触发“drop”和“eventReceive”事件,但是当我在列表视图上放置一个事件时,它不会触发这些事件。有没有办法做到这一点?

【问题讨论】:

  • 不,因为它只是一个事件列表,而不是一个网格。事件之间没有可以拖动任何东西的空白空间。为此使用议程或基本视图。
  • 这么认为,感谢您的快速响应。

标签: listview events fullcalendar droppable


【解决方案1】:

在获取有用的数据方面可能没有什么帮助,但如果您正在寻找一种方法来检测日历上的项目是否已被删除,您可以使用 jQuery 的 droppable stop 函数。

$(".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 没有办法确定你把它放到哪个项目上。

【讨论】:

  • 感谢您提供的信息!
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多