Skip to content

Commit f1b0ee7

Browse files
Refined attention seekers. Improved docs
1 parent 962e907 commit f1b0ee7

File tree

1 file changed

+21
-17
lines changed

1 file changed

+21
-17
lines changed

README.md

Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,10 @@ Traditional CSS animations often struggle with performance issues, especially on
4242
## Table of Contents
4343
- [Installation](#installation)
4444
- [Usage](#usage)
45-
- [Through direct invocation](#direct-invocation)
45+
- [Through direct invocation](#1-through-direct-invocation)
4646
- [Animate on initial load](#animate-on-initial-load)
4747
- [Setting Options](#setting-options-direct)
48-
- [Through function invocation](#function-invocation)
48+
- [Through function invocation](#2-through-function-invocation)
4949
- [Setting Options](#setting-options-function)
5050
- [Animate Multiple Elements](#animate-multiple-elements)
5151
- [Transition Events](#transition-events)
@@ -100,6 +100,8 @@ import { puffIn, puffOut } from 'animate4vue';
100100
101101
> **Tip**: Make sure there are no animations or CSS transitions applied or conflicting with elements to animate, they might interfere and mess things up. For example, avoid specifying CSS transitions globally.
102102
103+
<p align="right"><small><a href="#table-of-contents"><u>&uarr; Table of Contents</u></a></small></p>
104+
103105
#### Animate on initial load
104106
To animate elements on initial load, use the `appear` directive to trigger animations without conditional rendering with `v-if`:
105107
```html
@@ -110,7 +112,7 @@ To animate elements on initial load, use the `appear` directive to trigger anima
110112
</template>
111113
```
112114

113-
#### Setting Options <a id="setting-options-direct"></a>
115+
<h4 id="setting-options-direct">Setting Options</h4>
114116
Through 'direct invocation,' you can specify animation options by setting dataset attributes like so:
115117
```html
116118
<Transition @enter="flipInHorizontalLeft" @leave="zoomOutLeft" data-av-leave-ease="backIn" data-av-offset="100%">
@@ -121,6 +123,8 @@ Through 'direct invocation,' you can specify animation options by setting datase
121123
`data-av-[option property]="..."`
122124
> Options using dataset attributes apply to both @enter and @leave animations except [data-vn-enter-ease](#enterease) and [data-vn-leave-ease](leaveease).
123125
126+
<p align="right"><small><a href="#table-of-contents"><u>&uarr; Table of Contents</u></a></small></p>
127+
124128

125129
### 2. Through function invocation.
126130
This method involves handling animations within the `<script>`, offering greater control, such as adding fallbacks and handling `async` operations.
@@ -148,9 +152,9 @@ const animateOut = (el, done) => {
148152

149153
> **Important**: Always pass the done as a second argument, needed to tell Vue to remove the element out the DOM when animation is finished.
150154
151-
<p align="right"><small><a href="#table-of-contents">Table of Contents</a></small></p>
155+
<p align="right"><small><a href="#table-of-contents"><u>&uarr; Table of Contents</u></a></small></p>
152156

153-
#### Setting Options <a id="setting-options-function"></a>
157+
<h4 id="setting-options-function">Setting Options</h4>
154158
When using function invocation, you can pass options as a configuration object to the third parameter of the animation:
155159
```javascript
156160
const animateIn = (el, done) => {
@@ -164,7 +168,7 @@ const animateIn = (el, done) => {
164168
```
165169
> Function invocation also support setting options through dataset attributes in template.
166170
167-
<p align="right"><small><a href="#table-of-contents">Table of Contents</a></small></p>
171+
<p align="right"><small><a href="#table-of-contents"><u>&uarr; Table of Contents</u></a></small></p>
168172
169173
### Animate Multiple Elements
170174
You may use the `<TransitionGroup>` for animating multiple elements as they enter and leave the DOM:
@@ -187,7 +191,7 @@ const animationEnded = (el) => {
187191
<Transition @enter="vanishIn" @after-enter="animationEnded"></Transition>
188192
</template>
189193
```
190-
<p align="right"><small><a href="#table-of-contents">Table of Contents</a></small></p>
194+
<p align="right"><small><a href="#table-of-contents"><u>&uarr; Table of Contents</u></a></small></p>
191195
192196
### Asynchronous Support <a id="asynchronous-support-anim"></a>
193197
All animations return a Promise that resolves when the animation completes, allowing you to handle asynchronous operations using `await` or by chaining `.then()` and `.catch()`:
@@ -202,7 +206,7 @@ zoomIn(el, done).then(() => console.log('Success'))
202206
.catch((error) => console.log(error))
203207
```
204208
<small>[See all animations](#animations)</small>
205-
<p align="right"><small><a href="#table-of-contents">Table of Contents</a></small></p>
209+
<p align="right"><small><a href="#table-of-contents"><u>&uarr; Table of Contents</u></a></small></p>
206210
207211
208212
@@ -223,7 +227,7 @@ zoomIn(el, done).then(() => console.log('Success'))
223227
| [data-av-enter-ease](#data-av-enter-ease) | `"ease"` | `string` | `data-av-enter-ease="bounceIn"` |
224228
| [data-av-leave-ease](#data-av-leave-ease) | `"ease"` | `string` | `data-av-leave-ease="elasticIn"` |
225229

226-
<p align="right"><small><a href="#table-of-contents">Table of Contents</a></small></p>
230+
<p align="right"><small><a href="#table-of-contents"><u>&uarr; Table of Contents</u></a></small></p>
227231

228232
### Details
229233

@@ -344,7 +348,7 @@ const animateIn = (el, done) => {
344348
```
345349
346350
👆 In this example, only the data-av-delay option from dataset attributes will be applied, as the duration and ease options are specified in the function invocation.
347-
<p align="right"><small><a href="#table-of-contents">Table of Contents</a></small></p>
351+
<p align="right"><small><a href="#table-of-contents"><u>&uarr; Table of Contents</u></a></small></p>
348352
349353
350354
## Animations
@@ -397,7 +401,7 @@ const animateIn = (el, done) => {
397401
<small>More coming...</small>
398402
399403
[View live demo of animations](https://animate4vue.netlify.app)
400-
<p align="right"><small><a href="#table-of-contents">Table of Contents</a></small></p>
404+
<p align="right"><small><a href="#table-of-contents"><u>&uarr; Table of Contents</u></a></small></p>
401405
402406
403407
## Attention Seekers
@@ -430,7 +434,7 @@ const ringBell = () => {
430434
431435
![demo1](https://github.com/artisticLogicMK/animate4vue/blob/master/md_assets/demo1.gif)
432436
433-
### Setting Options <a id="setting-options-att"></a>
437+
### <h4 id="setting-options-att">Setting Options</h4>
434438
You can pass options to customize the animation behavior. For example:
435439
```javascript
436440
headShake(el, {
@@ -468,7 +472,7 @@ headShake(el, {
468472
469473
> Delay before the animation in seconds. Numbers below 0 denotes milliseconds(e.g 0.3). Also specify repeat delay of the animation when is on loop.
470474
471-
<p align="right"><small><a href="#table-of-contents">Table of Contents</a></small></p>
475+
<p align="right"><small><a href="#table-of-contents"><u>&uarr; Table of Contents</u></a></small></p>
472476
473477
### Stopping Attention Seekers
474478
Attention seekers provide a `kill()` method to stop ongoing animations, especially when set to loop. This allows you to halt the animation at any time.
@@ -511,7 +515,7 @@ onMounted(() => {
511515
512516
> **Tip**: Attention seeker animations also work with Transition component events. For example `@enter="jello"`.
513517
514-
<p align="right"><small><a href="#table-of-contents">Table of Contents</a></small></p>
518+
<p align="right"><small><a href="#table-of-contents"><u>&uarr; Table of Contents</u></a></small></p>
515519
516520
<br>
517521
@@ -542,7 +546,7 @@ const animateIn = (el, done) => {
542546
</Transition>
543547
</template>
544548
```
545-
<p align="right"><small><a href="#table-of-contents">Table of Contents</a></small></p>
549+
<p align="right"><small><a href="#table-of-contents"><u>&uarr; Table of Contents</u></a></small></p>
546550
547551
### API
548552
```customAnimation(element, done, direction, config)```
@@ -562,7 +566,7 @@ const animateIn = (el, done) => {
562566
563567
> Keep in mind that the animation properties defined for 'enter' dictate how the element appears when it enters, while those specified for 'leave' determine how it disappears.
564568
565-
<p align="right"><small><a href="#table-of-contents">Table of Contents</a></small></p>
569+
<p align="right"><small><a href="#table-of-contents"><u>&uarr; Table of Contents</u></a></small></p>
566570
567571
### Asynchronous Support <a id="asynchronous-support-custom"></a>
568572
The `customAnimation()` method returns a Promise that resolves when the animation is complete, allowing you to use `await` or chain `.then()` and `.catch()` for asynchronous operations:
@@ -580,7 +584,7 @@ customAnimation(el, done, "leave", {
580584
}).then(() => console.log('Animation Complete'))
581585
.catch((error) => console.log('Animation Error:', error));
582586
```
583-
<p align="right"><small><a href="#table-of-contents">Table of Contents</a></small></p>
587+
<p align="right"><small><a href="#table-of-contents"><u>&uarr; Table of Contents</u></a></small></p>
584588
585589
586590
## Feedback

0 commit comments

Comments
 (0)