Let the Vuejs transition occur exclusively during the opening of a slide

Trying to implement a smooth transition when the toggle button is clicked. Successfully applied the transition effect on the slider, but struggling to animate the text inside the div.hello class upon sliding open.

<transition name="slide">
    <aside v-if="sidebarOpen" :class="{ 'open' : sidebarOpen }">
      <a href="#">Haha</a>
      <a href="#">Nice</a>
      <a href="#">Menu</a>
    </aside>

</transition>
<div class="hello" :class="{ 'open' : sidebarOpen }">
   <p>This is a paragraph.</p>
   <p>This is a paragraph.</p>
   <p>This is a red.</p>
</div> 

The issue arises when placing the .hello element within the transition tag - all the p text disappears upon slide open and becomes visible during slide close.

Attempts were made to create another transition tag for div.hello, such as

<transition name="cslide"><div class="hello">
, but it proved unsuccessful.

The desired outcome is to have all the p tags move to the right upon slide open and return to their original position on slide close using CSS transitions.

View Codepen Example

Answer №1

The reason the text is not animating is because no transition property has been set. To make it animate, simply include the following code:

.hello {
  position: absolute;
  left: 0;
  color: white;
  transition: all .3s ease;
}
.hello.open {
  left: 300px;
}

For a live example, visit this codepen link

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

Get the value of an HTML element

Is there a way to retrieve the value of an HTML element using PHP or JavaScript, especially when the value is dynamically loaded from another source? I have tried using jQuery with the DOM ready event, but often encounter the issue where the element's ...

Utilizing Vue's dynamic component feature to create event listeners

Issue: My current project involves creating a versatile table component that can be utilized by other components to display tabular data. Each cell in this table could contain one of three possible values: Text HTML Component While I have successfully im ...

Modify the height of an element in real-time using jQuery

I'm looking to dynamically adjust the height of a div based on another element, but only if that element does not have the class collapsed (which is used in a Bootstrap toggle collapse feature). The initial setup seems to work fine, however, when I i ...

I have a desire to use Javascript to control CSS styles

Within the CSS code below, I am seeking to vary the size of a square randomly. This can be achieved using the Math.random() property in Javascript, but I am uncertain how to apply it to define the size in CSS. #square { width: 100px; height: ...

Having difficulty categorizing an array with a multi-dimensional structure using a computed function in VueJS

I am currently using Vue to update an array called "draggables" based on the logic that if an object exists in another array of arrays named "dropzones," it should be removed from draggables. Each draggable item will only be present in the index of the mu ...

Cease hover effect animation

Whenever I hover over the main span, the animation works perfectly. However, once I move the cursor away from it, the animation continues to run. How can I make it stop, and why does it persist? $('#menu span:first').hover(function (){ functi ...

Is it possible to combine Django urls and Vue routes in a single project?

After setting up my Django app and implementing the authentication layer using Django-Allauth with features like email confirmation, password reset, and two-factor authentication, I've come to the realization that for my app's interactive nature ...

When attempting to register a custom Gamepad class using GamepadEvent, the conversion of the value to 'Gamepad' has failed

I have been working on developing a virtual controller in the form of a Gamepad class and registering it. Currently, my implementation is essentially a duplicate of the existing Gamepad class: class CustomController { readonly axes: ReadonlyArray<nu ...

Using this.setState in ReactJS removes filters

Hey everyone, I've been struggling with a technical issue for the past few days and would really appreciate any hints or solutions. The problem lies in creating a table using the material-table library. Specifically, I need to extract the docID and do ...

What is the best way to showcase an image using Next.js?

I'm having a problem with displaying an image in my main component. The alt attribute is showing up, but the actual image is not appearing on the browser. Can someone please point out what I might be doing wrong? import port from "../public/port. ...

Effortless login authentication using Disqus through Google or Facebook tokens

I have set up my website to allow users to authenticate through Google and Facebook using passport, which uses the OAuth 2.0 API. Additionally, I am utilizing Disqus to manage the comments system on my site. However, I am running into a problem where user ...

Setting the root position of a div: How can it be done?

Imagine a scenario where a div element is designed to follow the mouse cursor on the screen. This functionality is achieved by manipulating the document's `mousemove` event and adjusting the div's `left` and `top` positions based on the event dat ...

Masonry ajax loading is not functioning properly

My images are supposed to load via ajax, but I am experiencing some issues. Sometimes it works perfectly fine, but most of the time they overlap each other like in this example. Where did I go wrong? Once I figure this out, I'll be able to refactor my ...

The combination of MUI CardContent and flexBox seems to have issues when used in conjunction with typography and chips

Take a look at this React code using MUI. It's designed to create a Card that showcases Character Information. const CharacterPreview = ({ characterKey }: CharacterPreviewProps) => { return ( <Card sx={{ maxWidth: 256, borderRadius: 4 }}&g ...

The animation speed of the jQuery hashchange event is set to zero, causing the animation

I'm facing an issue with jQuery where my animation inside a hashchange event is not smooth; it happens instantly when triggered. I'm looking for a way to make the animation smoother. jQuery( document ).ready(function() { jQuery(window).on(&a ...

Having trouble getting Handsontable to scroll smoothly in Chrome?

I'm currently facing an issue with handsontable specifically on Chrome. The problem is that although the table itself is scrollable, the values and row headings within the table do not update as they should. You can see the issue illustrated in the im ...

Managing a promise and using async/await functions

Having an issue with my node and express function router.post('/', async (req, res) => { const playlist = new Playlist({ song: req.body.song, artist: req.body.artist }) try { const newPlaylist = await play ...

Launch a VueJS component in a separate window

I am working on a VueJS application that currently consists of only one page and does not utilize vue-router for routing. My goal is to create a button that, when clicked, will trigger the window.open() function to display content from one of my Vue Compo ...

When utilizing auth0, an error occurs during the grunt build process

I successfully developed a small project using AngularJS on my local machine without encountering any issues. However, when I attempted to build the project with Grunt, everything stopped working and an error occurred: vendor.ce3c01a3.js:2 Error: [$inject ...

Step-by-step guide to minify Typescript files with Webpack

I am facing an issue in my webpack configuration while trying to minify the output bundle when working with TypeScript. Currently, only one file has been migrated to TypeScript in my project and it works fine with babel-node and the dev bundle without Ugli ...