The Move-class only applies to items within a transition-group that have not been removed if other items were removed

My item list is displayed in a flex-box, forming a matrix with several rows and items per row. I use the

<transition-group class="move">
to apply a simple move transition to the
<div v-for="item in items" :key="item.id">

move {
  transition: transform 1s;
}

Everything works perfectly when changing the order of items or adding new ones; all existing items smoothly move to their new positions.

However, when I remove items and create gaps in the list, the existing items do not fill these gaps smoothly. Instead, they jump to their new position without animation.

Why do the existing items behave differently, smoothly moving when a new item is added in between them but jumping back without animation when that same item is removed? How can I make the movement smooth in both scenarios?

Answer №1

Discovered the solution: When implementing the move transition, it is crucial for the -leave-active transition class to have a position: absolute declaration. This ensures that the element is removed from the layout flow, allowing its siblings to smoothly move into place around it.

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

Steps to create spaces between the bootstrap cards

Just diving into Bootstrap and attempting to incorporate images as cards, I encountered a challenge where the cards were piling up one after another without any spaces between them. Below is the code snippet utilizing Bootstrap4: <body> <div class ...

Unable to alter the height of the element

I am attempting to resize an element by dragging, similar to this example. I have created a simple directive for this purpose: @Directive({ selector: '[drag-resize]' }) export class DragResizeDirective { private dragging: boolean; const ...

CSS animation for image hover effect in Revolution Slider

I'm currently facing an issue while using Revolution Slider. To better illustrate, I am referring to the original demo found at this link: . When browsing through the 'portfolio' tab, you'll notice that the images shrink and darken upo ...

Child component not reflecting changes in Vue array prop

One issue I encountered is with a model from a backend where the property that typically contains an array of elements can be nullable. To handle this, I initialize it to an empty array. However, this seems to disrupt my ability to update the array in the ...

css - design your layout with floating div elements

I used to design layouts using tables, but now I'm trying it out with divs. However, I'm still struggling to get the layout right. It's not as straightforward as using tables. For instance, my code looks like this: var html_output = "< ...

What is the best way to use Vue to dynamically generate several bootstrap cards?

Utilizing Bootstrap cards with Vue dynamically is my goal. By using Bootstrap Vue, I am able to generate a card as shown below: <b-card title="Title" img-src="https://placekitten.com/500/350" img-alt="Image" img-top> <b-card-text> ...

What are the benefits of using CouchDB for login functionality, but encountering an empty CouchDB session while utilizing Vue.js and P

Utilizing Vusjs, pouchdb-browser, CouchDB, and pouchdb-authentication I am attempting to verify if a session is active for offline stay logged in. Upon logging in with db.logIn from pouchdb-authentication: response: {ok: true, name: "01HAYJ", ...

The font family specified in the Materia UI theme is experiencing compatibility issues on browsers that are not Chrome

Having difficulty overriding some elements with a specific font, as it seems to work perfectly on Chrome but not on other browsers like Safari and FireFox. Could there be something overlooked? Below is the code snippet: const customTheme = createMuiTheme( ...

Designing websites and Creating Visual Content

I have been working in IT for quite some time now, but recently I have started to delve more into web development. My main focus is on HTML 5, CSS 3, JavaScript, jQuery, and responsive design. However, one aspect that I always struggle with is images. I am ...

Creating Horizontal Repeating Cards in Three Columns with Bootstrap 4: Cards

I want to create a layout like the one shown below: card1 card2 card3 card4 card5 card6 card7 card8 card9 card10 card11 card12 card13 card14 card15 etc....(using asp.net repeater control) INSTRUCTION: I need the cards to be displayed horizontally in thre ...

Prevent Material UI Chips from altering color upon activation

Chip number 3 in the image below appears with a slightly darker background color when clicked, but this change is unnecessary as only the delete button has functionality. Therefore, the change in color serves no purpose. How do I prevent the background co ...

On mobile devices, a height of 100vh exceeds the visible screen area

Struggling to cover the entire visible part of the browser window using 100vh due to issues on certain devices and mobile browsers. For example, in Safari, the URL section hides a top part, and similarly on some Android devices using Chrome. https://i.stac ...

Ensuring only one group is open at a time in jQuery when a new group is opened

I need assistance in getting this functionality to work properly. My goal is to have only the clicked group open, while closing all others that are currently open. Here's a specific example of what I am trying to achieve: var accordionsMenu = $(&apo ...

Leveraging Vue.js plugin within a single file component

I am looking to utilize the vue-chartkick plugin in my Vue application, but I want to register it within my single-file components instead of globally. Is there a way to achieve this same functionality without using Vue.use(VueChartkick, { Chartkick })? ...

What steps can I take to improve the design of this layout created using Twitter Bootstrap?

Currently, I am designing a sample form layout using Twitter Bootstrap. The form displays fields horizontally, with a link between each field. My goal is to have bullet points appear on the right side of the fields when the link is clicked. However, the al ...

Incorporating a progress bar into the file upload feature

Looking to incorporate a minimalist progress bar using jQuery into this HTML. Any suggestions on the simplest approach? Just need a percentage value and a progress bar. <!DOCTYPE html> <html> <body> <form action="basic.php" method= ...

Margin challenge in CSS

Just starting out with CSS, so please be patient with me. I'm currently working on customizing a form and everything is looking good, except for the confirmation label which is located in a div. I've managed to create space between other elements ...

Maintain Vue Router Query Parameters Across Parent Components

In my application, I have a component named Foo, which serves as the template for a route called app/foo. Within this component, there are child components that also act as templates for routes such as app/foo/bar and app/foo/baz. I've implemented a ...

Identifying a phantom field error in the console

I'm encountering an issue where I am receiving an error message while attempting to validate my fields using VeeValidate on my system. Uncaught (in promise) Error: [vee-validate] Validating a non-existent field: "". Use "attach()" first. at creat ...

Developing a Vue.js application with a universal variable

In the previous version of Vue.js, 0.12, passing a variable from the root component to its children was as simple as using inherit: true on any component that needed access to the parent's data. However, in Vue.js 1.0, the inherit: true feature was r ...