1.基本用法,使用link引入
<head>
<link rel="stylesheet" herf="animate.min.css">
</head>
给你想添加动画效果的元素添加一个 animated 类(必需)。如果需要动画循环运动,你还需要给这个元素追加 infinite 类,又或者自己另外定义一个类似于 infinite 的类。
添加效果可以去官网上选取,还有相应的动画效果 https://daneden.github.io/animate.css/
实现代码:
<h1 class="animated infinite bounce">Example</h1>
2.jQuery 基本用法
$('#yourElement').addClass('animated bounceOutLeft');
3.在Vue-cli中的实现方式
下载animate
npm install animate --save
在main.js内引用
import animated from 'animate.css'
Vue.use(animated)
在需要使用动画的组件中写入
<transition
enter-active-class="animated bounceInRight"
leave-active-class="animated bounceOutRight"
>
组件名称
</transition>