Can anyone provide me with tips on incorporating animations into my modal using Vuejs transition?

I'm attempting to implement a sliding animation for this modal component that emerges from the bottom when the user clicks the button. The background blur displays correctly upon entering, but the modal fails to animate at all. My desired outcome is for it to slide in on opening and slide out on closure.

Any suggestions on the most effective approach to achieve this?

<template>
  <div>
    <a @click.prevent="toggle()">
      <slot name="button"></slot>
    </a>
    <div v-if="show" class="bg bg-transition fixed overflow-y-scroll top-0 left-0 flex flex-col items-center justify-center h-screen w-screen bg-opacity-25 bg-gray-400" style="backdrop-filter: blur(15px);">
      <transition mode="out-in" name="slideup">
        <div v-if="show" class="absolute top-0 right-0 left-0 bg-white rounded-tl-4xl rounded-tr-4xl w-full p-6 pb-0" style="margin-top:176px">
          <span class="flex items-center justify-center w-8 h-8 rounded-full bg-white text-gray-800 shadow" @click.prevent="toggle()">
            <svg
                class="fill-current w-full"
                xmlns="http://www.w3.org/2000/svg"
                width="24"
                height="24"
                viewBox="0 0 24 24"
              >
                <path
                  d="M19,6.41,17.59,5,12,10.59,6.41,5,5,6.41,10.59,12,5,17.59,6.41,19,12,13.41,17.59,19,19,17.59,13.41,12Z"
                />
                <path d="M0,0H24V24H0Z" fill="none" />
              </svg>
          </span>
          <div class="flex flex-col divide-y divide-gray-600">
            <div>
              <h1 class="heading mt-6">Placeholder Heading <br>R000pm</h1>
              <div class="mt-12 divide-y divide-gray-600">
                <div class="pb-8">
                  <h4 class="subheading">Placeholder Subheading</h4>
                  <p class="par mt-3">Placeholder Paragraph</p>
                  <div class="flex items-center justify-between mt-5">
                    <p class="font-semibold text-gray-1000 leading-none">Placeholder limit</p>
                    <p class="font-bold text-gray-1000 leading-none">R000,00</p>
                  </div>
                </div>
                <div class="py-8">
                  <h4 class="subheading">Placeholder Subheading</h4>
                  <p class="par mt-3">Placeholder Paragraph</p>
                  <div class="flex items-center justify-between mt-5">
                    <p class="font-semibold text-gray-1000 leading-none">Placeholder limit</p>
                    <p class="font-bold text-gray-1000 leading-none">R000,00</p>
                  </div>
                </div>
                // Repeat content until closing tags...
             </div>
           </div>
            // More repeating content...
       </div>
     </transition>
   </div>
 </lt;/div>
</template>

// CSS styling ommitted 
....

Answer №1

In the realm of HTML5 element transitions, incorporating them into dynamically generated elements can often lead to confusion and complexity. For more insight on this topic, I recommend checking out this informative response on StackOverflow.

An alternative approach is to utilize a v-show directive instead of relying solely on a v-if. By doing so, Vue will render your component and then simply conceal it using the CSS property display: none.

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

JavaScript: What is the best way to loop through specific properties of a JavaScript object?

I have a JavaScript object structured as follows: const columns = { firstLabel: 'Hello', secondLabel: 'world', thirdLabel: 'I', fourthLabel: 'Am', fifthLabel: 'Paul', }; My goal is to e ...

Plaid webhook failing to activate

I've been struggling to set up Plaid transaction webhooks in an api, as I can't seem to get any webhooks to trigger. I followed the plaid quickstart code and included the webhook parameter: Plaid.create({ apiVersion: "v2", clientName: ...

A guide on utilizing the React Suite range slider in rsuite

Hello there, I recently started working with the UI framework rsuite (React suite) and everything was going smoothly until I tried to use the Range slider component's API. Unfortunately, I am facing some issues with the labels and tooltips not display ...

How to access nested JSON elements in Javascript without relying on the eval function

Below is a JSON that I am trying to access. { "orders": { "errorData": { "errors": { "error": [ { "code": "ERROR_01", "description": "API service is down" } ] } }, "status": " ...

Error: 'window not defined' or 'document not defined' encountered while importing a module in Next.js

I'm working on integrating a Wysiwyg editor into my web application. However, I encountered an error when trying to import the editor module. I tried using both react-draft-wysiwyg and react-quill. The former resulted in a "window not defined" error, ...

The export button in the React Material Table doesn't seem to be displaying correctly

[I am encountering an issue with the React export button in Material Table. The bar is not showing completely. My code includes the following: options = {{exportButton:true}} How can I resolve this?]1 ...

Error: NextJS cannot access the 'map' property of an undefined object

Hey everyone, I usually don't ask for help here but I'm really struggling with this piece of code. I've tried looking at various resources online but can't seem to figure out why it's not working. Any guidance would be greatly appr ...

Angular JavaScript Object Notation structure

I am a beginner in AngularJS and I'm attempting to create formatted JSON based on the values of table rows (tr) and cells (td). The table rows are generated automatically. When the form is submitted, I try to create the JSON values. Once the form is ...

Tips for verifying the "truthiness" of an object, removing any falsy values, and making changes to the object

I am faced with the task of examining each property of an object to determine if it is truthy, and then removing any that are not. var user = { name: 'my name', email: null, pwHash: 'U+Ldlngx2BYQk', birthday: undefined, username: &ap ...

Could you explain the significance of the code "a[href*=#]:not([href=#])"?

I'm a bit confused about the meaning of this code. Can someone explain it to me? a[href*=#]:not([href=#]) Appreciate the help! ...

Material Ui and react-router onClick event latency on handheld devices

My React application is currently using @material-ui/core v.1.2.1 and react-router 3.0.2, which I am unable to update at the moment. Whenever I click a button that handles navigation, there is a noticeable delay of around 2 seconds before it works. https: ...

When items are rearranged or moved between lists, the jQuery UI Sortable is triggered

Is there a way to trigger a jQuery UI Sortable event only when an item is dragged from one list to another, or rearranged within the same list? In addition, I would like to identify the original source list of the dragged item. I attempted using the stop ...

What is the best way to ensure that a child div can expand to fit within the scrollable area of its parent div

I am facing an issue with a parent div that changes size based on the content inside it. When the content exceeds the initial size, causing the parent to scroll instead of expanding, I have a child div set to 100% width and height of the parent. However, t ...

Irregular word spacing observed in HTML code

The alignment of text on my website is causing some spacing issues that I can't quite seem to resolve: It's an asp.net page, and I've attempted a couple of potential solutions: CSS .optionClosed { font-size: large; ...

Manipulating elements within the React framework

Having trouble figuring out how to display the content of Notification.jsx in index.js? There's a button in the Header.jsx file that, when clicked, should show the content of the Notification component. Is it possible to hide the h1 element once the b ...

Aggregation pipeline update or push in MongoDB

I have a database model in MongoDB that includes an array of members as objects. const guestSchema = new mongoose.Schema({ salutation: { type: String, }, members: [membersSchema], user: { type: mongoose.Schema.ObjectId, ref: 'User& ...

Utilizing CSS within JavaScript

Can someone assist me with applying CSS to my Javascript code? I'm not very skilled in this area, so I'd appreciate insight from those who are knowledgeable. My JS is used for the menu hover effect, and here is the code: $(function(){ $(&ap ...

Include TypeScript in a single component within an already established Vue project

I've been working on a large Vue project and I want to integrate TypeScript into it. However, every time I try to do so, I run into a lot of errors that take weeks to fix. Instead of going through that, I'd like to find a way to add TypeScript to ...

My PHP errors and success messages are not being displayed properly after an AJAX success

After making an AJAX call to submit a form, I would like to display either the PHP success message or error message upon completion. This is my current AJAX success function: success: function (data) { resultSuccess = $(data).find("#success") ...

Ways to slightly boost the default font-size values when using wicked-pdf

In the wicked-pdf report, I have body content with varying font sizes. When I apply a font-size of 16px to the paragraph like so: p { font-size: 16px !important; } The entire paragraph's font size becomes 16px, which may include words with diff ...