Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to disable popover when I dragging event?

How can I hide popover element when I start dragging event in fullcalendar and after stop dragging show popover again?

I have this code:

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'
        });
      }

And when I want to resize or dragging event this happend:

enter image description here

Thank you!

like image 445
Alexander Frolov Avatar asked Mar 06 '23 13:03

Alexander Frolov


1 Answers

You should use eventAfterRender instead of eventRender function to achieve the desired result. So your code will look like this:

  eventAfterRender: function(event, elementos, resource, view) {
    // code goes here
  }

This works because eventRender is constantly called while dragging because the event is constantly being "snapped" into a cell (in non-month views) and hence ends up creating all the popovers, while eventAfterRender is triggered after an event has been placed on the calendar in its final position.

You can see it in action here in this codepen

like image 100
myusuf Avatar answered Mar 10 '23 11:03

myusuf