How can I turn off popover when I am moving an event?

Is there a way to hide the popover element when dragging an event in fullcalendar, and then show the popover again after the dragging is stopped?

Here is the code I am currently using:

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

When I try to resize or drag the event, this is what happens:

https://i.sstatic.net/04GVA.png

Any insights or suggestions are greatly appreciated. Thank you!

Answer №1

To achieve the desired outcome, it is recommended to utilize the eventAfterRender function instead of eventRender. Update your code as follows:

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

The reason for this change is that eventRender is continuously called during dragging as the event is snapped into a cell (in non-month views), resulting in multiple popovers. On the other hand, eventAfterRender fires after the event has been positioned on the calendar in its final place.

You can observe this modification in action through this CodePen example.

Answer №2

Dealing with a similar issue led me to create a practical solution. Taking inspiration from Taha's code, I have crafted a ready-to-use snippet for anyone seeking guidance on integrating Fullcalendar:

eventDragStart: function( event, jsEvent, ui, view ) {
  window.eventScrolling = true;
},
eventDragStop: function( event, jsEvent, ui, view ) {
  window.eventScrolling = false;
},
eventRender: (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'
    });
  }
},
eventResize: function(event, delta, revertFunc) {
  $(".popover").remove();
},

Answer №3

To ensure proper functionality, make sure to include $(".Popover").Remove(); before the element.popover call within the eventRender function. An example implementation is shown below:

eventRender: function(event, element, resource, view) {

       $(".Popover").Remove();

var start = $.fullCalendar.formatDate(event.start, "DD-MM-Y HH:mm");
var end = $.fullCalendar.formatDate(event.end, "DD-MM-Y HH:mm");
element.popover({
    title: start + ' — ' + end,
    content: event.title,
    trigger: 'hover',
    placement: 'top',
    container: 'body',
      live: true,
            html: true,
            placement: 'above'
});
            }

Answer №4

Shoutout to Marcelo Codo, his solution really helped me out. Successfully implemented in fullcalendar version 4

$('.popover').remove();
$(info.el).popover({ title: 'ddd', placement:'top', trigger : 'hover', content: tooltip, container:'body' }).popover('show');

Answer №5

To prevent the popover from rendering during scrolling events, you can set a flag to control its display.

Here is a pseudocode example:

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

$("element").on("dragend", function(){
   window.eventScrolling = false;
});

eventRender: function(event, elements, 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");
    
    elements.popover({
        title: start + ' — ' + end,
        content: event.title,
        trigger: 'hover',
        placement: 'top',
        container: 'body'
    });
}

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

The issue with the dispatch function not working in the Component props of React Redux

I'm struggling with my colorcontrol issue. I've been attempting to use this.props.dispatch(triggerFBEvent(fbID, method, params)) without success. Interestingly, it seems to work fine if I just use triggerFBEvent(fbID, method, params). However, I ...

Ways to verify if the current date exists within a TypeScript date array

I am trying to find a way in typescript to check if the current date is included in a given array of dates. However, even after using the code below, it still returns false even when the current date should be present within the array. Can anyone please pr ...

Display popup just one time (magnific popup)

Attempting to display this popup only once during a user's visit. It seems like I might be overlooking something. <script src="http://code.jquery.com/jquery-1.7.min.js"> <link href="http://cdnjs.cloudflare.com/ajax/libs/magnific-popup.js/1.1 ...

Retrieving search results in JSON format from a website with NodeJs

I recently started learning Node and attempted to retrieve a website's search result in JSON format using Node. I experimented with the HTTP chunk method and Express GET, but unfortunately, was unable to find a solution. The specific URL I was working ...

How can I use JavaScript api calls to retrieve an image url and insert it into an image tag in an

I have a JSON object that I need to use to retrieve images from a remote URL and display them in the img tag using API calls. The API link can be found at <div class="emoji"> <ul id="emojiz"></ul> <span style= ...

How can I extract the page's output using JQuery?

Being a rookie in this area, I am eager to learn how to extract specific content from a page using AJAX in JQuery. Currently, I have been able to fetch the data of a page and display it as text: $.ajax({ type: "POST", url: "myfile.html", su ...

Error encountered when attempting to display a particular user with a specific _id in MongoDB, Node, and React: Failed to convert value "undefined" to ObjectId in the "user" model

I am experiencing an issue on my page where multiple users are displayed. Whenever I click on a user, it should redirect me to their individual page, but instead, I encounter the following error: Cast to ObjectId failed for value "undefined" at path "_id" ...

I am interested in modifying the hover effect for the text letters within the material UI container when hovering over it

this is the code I am currently working with: import React, { Component } from "react"; import MobileDetect from "mobile-detect"; import { map, orderBy, flowRight as compose, isEmpty, get } from "lodash"; import { Grid, Li ...

The input value is displaying one value, but the output is showing a different value

I am encountering a unique issue and could really use some assistance. <input class="testVal" type="number" id="GT_FIRING_TEMPERATURE" value="-17" name="degC" onchange="angular.element(this).scope().unitConversion(value,name, id)"> Despite the valu ...

Leverage JavaScript to run a snippet of PHP code directly (without utilizing a separate PHP file)

I am looking for a way to integrate PHP into my web page using JavaScript and AJAX. I want the PHP file to be included and executed as if it is part of the native page, allowing me to utilize features like GET requests. <div id="firstAjaxDiv">Defaul ...

Retrieve all elements from JSON using jQuery

JavaScript: function loadDoc(url) { $.ajax({ url: 'mytestjson', dataType: 'json', cache: false }).success(function (result) { console.log(result); //var txt = result.newBranches[0].newNon ...

Collaborating with SockJS connectivity

Currently, my Node.js backend is interacting with desktop clients using websockets. The communication from the server side is initiated from a web front-end and everything is functioning properly because I am storing the SockJS Connection instances in an ...

Using jQuery to loop through a collection

I have a page that displays a list of posts. When a user clicks on the show comments button for a particular post, the comments associated with that post become visible. This functionality is achieved by using this and then searching based on the click loc ...

When pressing the next or previous button on the slider, an error message pops up saying "$curr[action] is not a

I found this interesting Js fiddle that I am currently following: http://jsfiddle.net/ryt3nu1v/10/ This is my current result: https://i.sstatic.net/VygSy.png My project involves creating a slider to display different ages from an array, such as 15, 25, ...

Utilizing Three.js to Upload Images and Apply Them as Textures

While attempting to upload an image via URL and set it as a texture, I encountered an issue. The error message THREE.WebGLState: DOMException: Failed to execute 'texImage2D' on 'WebGLRenderingContext': Tainted canvases may not be loaded ...

[Vue alert]: Issue encountered in mounted hook: "Error: viewType "" is not accessible. Please ensure that you have loaded all essential plugins

Having some trouble using FullCalendar as a vue component in Laravel. I've followed the documentation and loaded the plugins correctly, but for some reason, they are not loading properly. https://fullcalendar.io/docs/vue Here's the Component: te ...

Establish initial content for the specified div area

I need help setting page1.html to display by default when the page loads. Can you provide some guidance? Appreciate your assistance in advance. <head>     <title>Test</title>     <meta http-equiv="content-type" content="tex ...

Leverage Jquery within the div element to manipulate the data retrieved from a post ajax request

On my one.jsp page, I have the following post code: $.post("<%=request.getContextPath()%>/two.jsp", { vaedre: fullDate} ,function(result){ $("#theresult").append(result); }); This code generates the followi ...

What is the best approach for integrating HTML and JavaScript code into Flutter mobile platforms?

For the past 4 months, I've been immersing myself in Flutter without any prior experience in Javascript. My goal is to utilize the Soundcloud HTTP API to create a user-interactive app. However, I've hit a roadblock when it comes to integrating JS ...

Refine your search by name following the implementation of a character-altering filter

Encountered a scenario in which there is a need to filter elements generated by the 'ng-repeat' directive. I have implemented a custom filter that replaces one character with another and vice versa for each element created. However, when attempt ...