首先贴个官网:
https://daneden.github.io/animate.css/1、引入animate css文件
1 ????<head>2 ??????????<link rel="stylesheet" href="animate.min.css">3 ????</head>
2、给指定的元素加上指定的动画样式名
???<div class="animated bounceOutLeft"></div>
这里包括两个class名,第一个是基本的,必须添加的样式名,任何想实现的元素都得添加这个。第二个是
指定的动画样式名。
3、如果说想给某个元素动态添加动画样式,可以通过jquery来实现:
???$(‘#yourElement‘).addClass(‘animated bounceOutLeft‘);
4、当动画效果执行完成后还可以通过以下代码添加事件
???$(‘#yourElement‘).one(‘webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend‘, doSomething);
你也可以通过 JavaScript 或 jQuery 给元素添加这些 class,比如:
1 ????$(function(){2 ????????$(‘#jq22‘).addClass(‘animated bounce‘);3 ????});
有些动画效果最后会让元素不可见,比如淡出、向左滑动等等,可能你又需要将 class 删除,比如:
1 ????$(function(){2 ????????$(‘#jq22‘).addClass(‘animated bounce‘);3 ????????setTimeout(function(){4 ????????????$(‘#jq22‘).removeClass(‘bounce‘);5 ????????}, 1000);6 ????});
animate.css 的默认设置也许有些时候并不是我们想要的,所以你可以重新设置,比如:
1 ????#jq22{2 ????????animate-duration: 2s; ???//动画持续时间3 ????????animate-delay: 1s; ???//动画延迟时间4 ????????animate-iteration-count: 2; ???//动画执行次数5 ????}
所有的动画样式名请参见demo页面。
最后再贴个网站结尾,版权归以下网站所有,作者:hacker
http://www.jq22.com/jquery-info819
关于动画Animate.css的使用方法
原文地址:http://www.cnblogs.com/yuanguliang/p/7523810.html