编程语言
首页 > 编程语言> > javascript-拖动事件时如何禁用弹出窗口?

javascript-拖动事件时如何禁用弹出窗口?

作者:互联网

当我在fullcalendar中开始拖动事件并在再次停止拖动show popover之后如何隐藏popover元素?

我有以下代码:

eventRender: function(event, elementos, resource, view) {
        var start = $.fullCalendar.formatDate(event.start, "DD-MM-Y HH:mm");
        var end = $.fullCalendar.formatDate(event.end, "DD-MM-Y HH:mm");
        elementos.popover({
          title: start + ' — ' + end,
          content: event.title,
          trigger: 'hover',
          placement: 'top',
          container: 'body'
        });
      }

当我想要调整大小或拖动事件时,发生了这种情况:

enter image description here

谢谢!

解决方法:

您可以向滚动事件添加一个标志,该标志不应呈现弹出窗口.

伪代码:

$("element").on("dragstart", function(){
   window.eventScrolling = true;
});

$("element").on("dragend", function(){
   window.eventScrolling = false;
});
eventRender: function(event, elementos, resource, view) {
    if(window.eventScrolling) return;
    var start = $.fullCalendar.formatDate(event.start, "DD-MM-Y HH:mm");
    var end = $.fullCalendar.formatDate(event.end, "DD-MM-Y HH:mm");
    elementos.popover({
        title: start + ' — ' + end,
        content: event.title,
        trigger: 'hover',
        placement: 'top',
        container: 'body'
    }
});

标签:twitter-bootstrap,fullcalendar,javascript
来源: https://codeday.me/bug/20191109/2011980.html