Animating list items within a grid using Vue.js

I have arranged a list of items inside a grid using vuejs, and I am dynamically updating the content of a cell within the grid by changing the class name. My goal is to change the element inside the cell using CSS3 animation. I tried applying CSS animation using transition-group, but it's not behaving as expected. The CSS class creates a new element that drops to the next line before hiding the previous element. How can I achieve an animation in place right inside the cell?

Check out the jsfiddle example here: https://jsfiddle.net/49gptnad/274/

<div id="vue-instance">
  <transition-group tag="div" name="fade" class="uk-grid">
    <div class="uk-width-1-2" v-for="item in thumbs" :key="item.id">
      <div class="item">
        <i class="fa" :class="item.icon" aria-hidden="true"></i>
        <h3>{{item.name}}</h3>
      </div>      
    </div>
  </transition-group>
</div>

Answer №1

To resolve the issue, one option is to conceal the icon that was previously displayed:

.fade-enter-active {
  visibility: hidden;
}

Access the revised fiddle by clicking here

Answer №2

You might want to consider implementing the following solution:

.element {
    text-align: center;
    font-size: 22px;
    transition: opacity .6s;
    animation: fade-in .6s;
}

@keyframes fade-in {
    from {opacity: 0;}
    to {opacity: 1;}
}

https://jsfiddle.net/92qjzuer/1877/

I eliminated the transition properties in the HTML and replaced them with a basic keyframe animation.

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

Ongoing Loop Needed for Banner

After some exploration in my previous post about creating banners, I have gained a better understanding of some new concepts... function animate(el) { var div = $(el); return div.css("display","block").animate({width:0},1).animate({width:1100},2000).d ...

JavaScript - Functions in objects losing reference to previously created object properties

Having trouble with my Candy function. When I create an object of the Candy function, all attributes are created correctly. However, when I try to run the draw function, it always uses the properties of the second object created instead of the one I want. ...

What is the best way to create an array within an object in JavaScript?

Here is the code snippet I'm working with: var Memory ={ personAbove: "someone", words: wordsMem = [] <<<<<this part is not functioning properly } I need help figuring out how to make it function correctly. Specific ...

In PHP/HTML, input submit does not work with CSS styling

I am struggling with styling the input submit button in my form. I want the button to appear as text with a change in background and font color on hover. Any solutions? input[type="submit"] { font-family: made, mirage; text-decoration: none; backg ...

Optimizing Bootstrap 4 Flex-Row Dimensions

Issue: I'm currently working on a relatively intricate ListGroup using bootstrap v4. The .flex-row div is displaying some mysterious white space at the bottom, and I need assistance in eliminating it. Attempts Made So Far: I've experimented w ...

Implementing a click event for multiple controls by utilizing class names in Angular

I have been able to successfully attach a click event in Angular using the following method: <span (click)="showInfo()" class="info-span"></span> However, I have 20 spans with similar attributes. Is there a more centralized ...

Is it possible to utilize AJAX to fetch code from a separate file, view, or page in order to create an experience akin to a single-page application

Essentially, I'm aiming to create a simplified version of a Single Page Application within the admin panel of my website. The idea is to organize the information by using tabs, making the panel less cluttered. Here's a rough layout of what I have ...

Tips for adjusting text placement on a Bootstrap responsive webpage:

Hey there, I hope everything is going well. I'm facing a little issue here. I'm trying to design a page layout that looks like this: Image - Description Description - Image Image - Description and so on... However, when viewed on a smaller devi ...

Center text vertically inside a form

I have attempted various solutions provided in previous responses, but none have proven effective for my situation. The challenge I face is aligning the bar vertically within this form. <form action="index?q=<?php echo $_POST['query']? ...

Tips for displaying a specific amount of significant digits in a numerical output

Below is the JSON data that needs to be displayed on a web browser: { "testDoubleArr": [1, 2.0, 3.45], "testStr3": "SHA", "testDouble1": 12.56, "testDouble2": 1.0, "testStr1": "OMG" } When displayed on the browser, it appears in the following f ...

Leverage ConvexGeometry within the npm release of THREE

Is there a way to utilize ConvexGeometry in the npm version of THREE? It appears that it was introduced in r85: https://github.com/mrdoob/three.js/releases I noticed that it's only present in the example folder. Is there a method to incorporate it ...

Looping through a jQuery/js script, adding a unique variable with varying ending numbers to individual div elements

Imagine having an array of variables like so: example1 = 1 example2 = 32 example3 = 3345 and so forth up to something large, for instance example100 = 222 The goal is to insert each number into a separate div, with each div identified by: <div class ...

Updating the background of a specific div element by retrieving data from an SQL database

I have a unique situation where I have a div element with the property set to runat="server" and an ID assigned to it. I am attempting to dynamically set the background image for this specific div from a MySQL database where the path URL is stored in a r ...

What is the best way to immediately update the state in a React functional component?

Having recently started learning React, I find myself struggling to understand the lifecycle of a functional component. Let's consider a scenario where I have multiple checkboxes labeled as: checkbox, a, b, c, and d, each corresponding to values a, b, ...

Modifying Bootstrap image dimensions

I've been working on creating a card div with two images inside: an up arrow and a down arrow. Everything looks good when the page is in full screen mode, with the images displaying at their full size. However, with Bootstrap's responsive design ...

Will my variables become unbound when a new object is created?

Currently, I am developing a component within my Angular application where I am binding an object: CustomComponent.js angular.module("app").component( "customComponent", { controller: function() { var ctrl = this; ctrl.createInstance ...

The utilization of the JavaScript null coalescing operator ?? resulted in a crash of the .NET JS minifier/bundler

I'm facing an issue with my code where using the ?? operator causes a crash in the MVC built-in bundler/minifier. The problematic line is: span.textContent = typeof (info) === 'object' ? info.column.caption ?? info.column.dataField : info; ...

AngularJS - Alter the URL with $state.go without refreshing the HTML content

Struggling with routing in angularJS and can't seem to find a solution despite trying various methods online. Any assistance would be greatly appreciated. Encountering an issue with the $state.go function in which it changes the URL but fails to load ...

Refreshing jQuery plugins using ES6 JavaScript following an ajax page refresh

I recently created a website that utilizes a router system for ajax page loading. The site is built with webpack and organized as ES6 JavaScript modules. Although I have integrated some third-party jQuery plugins, they seem to only work properly when the p ...

Optimize Your Reactstrap Carousel Images for Responsiveness

Despite my extensive search efforts, I have found very limited documentation on how to make images within a ReactStrap carousel responsive to resizing. While the ReactStrap carousel itself is responsive, the images inside it do not resize accordingly. So ...