Adjusting (css styles like top, left, and width) for an external occurrence within fullcalendar

$scope.ctrlstartDragging = function(id) {

            var book = document.getElementById(id);
            var domRect = book.getBoundingClientRect();
                book.style.position = 'fixed';
                book.style.top = domRect.top + 'px';
                book.style.left = domRect.left + 'px';
                book.style.width=(domRect.width) + 'px';

        };
        $scope.ctrlendDragging = function(id) {

           var book = document.getElementById(id);
                book.style.position = 'relative';
                book.style.top = 'unset';
                book.style.left = 'unset';
                book.style.width='unset';
        };

After applying a filter to the external events search input, a strange behavior occurs where the last dropped event in the calendar unexpectedly moves to the top as if the drag and drop function is automatically re-applied. This issue is causing confusion and disruption to the expected behavior of the events in the calendar.

To reproduce the issue, follow these steps:

1. Drag and drop event 4 into the calendar

2. Search for event 111 using the input search

3. Drag and drop event 111 from the filtered results into the calendar

4. Clear the filter either manually or by using the clear button

Upon clearing the filter, the last dropped event (event 111) moves to the top of the calendar instead of remaining integrated within the event list.

The issue seems to be related to the drag and drop function not properly resetting after clearing the filter, causing the last dropped event to behave unexpectedly.

To further demonstrate the problem:

1. Refresh the browser

2. Uncheck the "Remove after a drag" option

3. Drag and drop any event into the calendar

After following these steps, you will notice that the last dropped event in the calendar moves to the top of the external events box.

My question is how can we properly fire the ctrlendDragging function to unset/reset the top, left, and width CSS styles of a book element, reverting it to its initial state before any dragging or moving operations?

View the codePen for reference

Related inquiries:

Stack Overflow Question 1 Stack Overflow Question 2

Thank you for your assistance in resolving this issue.

Answer №1

drop: function() {

                // reset 
                var titleIndex=$(this).attr('id');
                $scope.endDragging(titleIndex);


                // check if the "remove after drop" checkbox is selected
                if ($('#drop-remove').is(':checked')) {
                    // if it is, remove the element from the list
                   $(this).remove();


                }
            }

This workaround was created because ondragend was not firing and as a result, $scope.endDragging was not being triggered.

View the CodePen example

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

How can I prevent IE10/IE11 from displaying the open or save prompt?

Currently, I am utilizing JavaScript blob to download files from the server as shown below: let blob = new Blob([resposne['_body']], { type: contentType }); if (navigator.msSaveBlob) { navigator.msSaveOrOpenBlob(blob, fileName); // applicabl ...

Positioning elements in CSS using percentages allows for flexible and responsive

I am new to web design and I am trying to create a webpage similar to the one shown in this image. However, I want to set the height and width of the divs using percentage values instead of pixels. Whenever I attempt this, the boxes end up overlapping or ...

Retrieve the object when hovering over an element in the grid

In a collection of 16 items belonging to the same class, I am looking for a way to implement a mouseover effect that changes the opacity of only the specific item being hovered over and not all items in the class. Check out this link for an example ...

I've exhausted all options from stackoverflow with no success. Google Chrome's Autofill feature is wreaking havoc on my theme. Any suggestions on how to tackle this issue?

I designed a template with a stunning CSS layout. All I want is to have a transparent background with white font color, but Google Chrome seems to be causing issues with my theme. What steps should I take? I've exhausted all resources available onlin ...

Is it possible to update the background image of my iframe video?

I'm looking to customize the play button on a video displayed through an iframe on my website. Here is the code snippet I've been working with: .ytp-cued-thumbnail-overlay-image { background: url(https://www.example.com/images/video-play-butt ...

Tips for verifying the status of an input element following the dynamic addition of a required element

I have implemented a required field for all input elements in a specific state using the following code: for (var i = 0; i < data.length; i++) { // activate required function v = data[i].Required; if (v) document.ge ...

Is there a way to undo the transition when hovering out?

Is it possible to achieve a reverse transition animation on hover out using CSS? I want the "Menu" text to slide to the right blue line when I hover out, and after a delay of 400ms, slide back from the left grey line. Can this be done? .menu { displ ...

The container is unable to contain the overflowing Slick carousel

The carousel in Slick is overflowing the container. Expected Result - First Image / Current State, Second Image Parent Container HTML (layout) <main> <div class="layout__main-container p-4"> <app-discover-animals clas ...

Unexpected white space appears at the bottom of the page when rotating the device in iOS Safari

One issue I encountered on my website involves a meta tag: <meta name="viewport" content="width=device-width, initial-scale=1.0"> This, combined with height:100%; on the html and body tags, causes problems when viewed on Safari ...

How can I resolve the issue of TypeScript AngularJS component modal where the function this.$modalInstance.dismiss is not working?

After converting one of my user data entry forms into a uib-modal, I encountered an issue when trying to close the modal using the "cancel" button. The error message "this.$modalInstance.dismiss is not a function" keeps popping up. The same problem occurs ...

Sequential invocations to console.log yield varying outcomes

So, I'm feeling a bit perplexed by this situation. (and maybe I'm missing something obvious but...) I have 2 consecutive calls to console.log. There is nothing else between them console.log($state); console.log($state.current); and here's ...

Making modifications to the CSS within an embedded iframe webpage

Assigned with the task of implementing a specific method on a SharePoint 2013 site. Let's dive in. Situation: - Within a page on a SharePoint 2013 site, there is a "content editor" web part that displays a page from the same domain/site collection. T ...

The iPhone 6 Plus's Safari browser, when in landscape mode, displays multiple tabs open at once. Additionally, when a Bootstrap modal

Encountering an issue with the bootstrap modal on iPhone Safari 6+ in landscape mode. This glitch only happens when using multiple tabs on the browser. Follow these steps to replicate the problem: 1) Visit http://getbootstrap.com/javascript/ on your iP ...

adjusting three sections within a flexible navigation bar

Having difficulties creating a dynamic navbar that changes on scroll and keeping the elements within the nav fixed when the menu options appear. For reference, you can check out this codepen: http://codepen.io/timothyfernandez/pen/azXQPV Any assistance w ...

The issue with the max-height transition not functioning properly arises when there are dynamic changes to the max-height

document.querySelectorAll('.sidebarCategory').forEach(el =>{ el.addEventListener('click', e =>{ let sub = el.nextElementSibling if(sub.style.maxHeight){ el.classList.remove('opened&apos ...

What could be causing the issues with the compatibility of <input type="text" and flex properties?

I'm having an issue where the search box expands in size when I apply display:flex in my CSS. Can someone explain why this happens and offer a solution to return the search box to its normal height? Additionally, I would like the search bar and the se ...

Tips for seamlessly incorporating a fresh ionic theme into your current ionic application

I am currently developing a project with Ionic v1 and Angular 1, using the basic Ionic UI. While browsing through the Ionic marketplace, I found several interesting themes. Can someone guide me on how to implement a new Ionic theme into my existing appli ...

The function was expecting an array for ordering, but instead received an object

I need help filtering my results based on their position. Whenever I try to use the orderBy function, it breaks the page because the result is not an array. How can I fix this issue? I'm currently stuck at this point. This is how I attempt to filter ...

Exploring cookie evaluation in AngularJS routes and templates

I am in the process of implementing a login system using cookies to ensure that a user stays logged in even after leaving the application. While I have successfully set the cookie, I am unsure of how to utilize it to restrict access to the login screen for ...

Using AngularJS directives like ng-hide, ng-show, or ng-if to control visibility based on the active state of

Hello, I am currently developing a shopping cart with three different views: menu, options, and order. The list is generated using ng-repeat from JSON data, with each item in the array having an 'active' field set to false. When an item is added ...