formkit / auto-animate

A zero-config, drop-in animation utility that adds smooth transitions to your web app. You can use it with React, Vue, or any other JavaScript application.

Home Page:https://auto-animate.formkit.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to animate single element?

nestle49 opened this issue · comments

How to animate single element? For example

<template>
<div v-if="content">Content</div>

<button @click="content = !content">Toggle</button>
</template>

<script setup>
const content = true;
</script>

You need to apply auto-animate to the whatever dom element is the parent of your content div 👍

You need to apply auto-animate to the whatever dom element is the parent of your content div 👍

But it means redundant markup DOM, also empty elements if children are hidden

there is almost always a parent element. If not, then you cannot use auto animate. You can just use the <Transition> component in vue.