Animate.css(一款有意思的CSS3动画库)

官网:https://daneden.github.io/animate.css/css

animate.css 是一款跨浏览器的动画库。git

使用方式:github

  1. 在页面的 <head>中引入样式文件:web

    <head>
    <link rel="stylesheet" href="animate.min.css">
    </head>
  2. 给你想要添加动画效果的元素加上 animated 样式,若是想要动画循环执行的话,你须要加上 infinite 样式。浏览器

  3. 具体样式在官网一一列举出来啦,并且能够直接查看效果,很炫酷啊!

例子:动画

<h1 class="animated infinite bounce">Example</h1>

当你将 animate.css 与 jQuery 一块儿使用或者添加你本身的 CSS 规则时, 你能够用 animate.css 作一大堆其余的事,使用 jQuery 动态添加动画:spa

$('#yourElement').addClass('animated bounceOutLeft');

你也能够检测一个动画是否结束了:code

$('#yourElement').one('webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend', doSomething);

注意: jQuery.one() 用在你但愿只执行事件一次 的时候。blog

你能够改变更画的持续时间,添加延迟或改变它执行的次数:token

#yourElement {
  -vendor-animation-duration: 3s;
  -vendor-animation-delay: 2s;
  -vendor-animation-iteration-count: infinite;
}

注意:确保用供应商的前缀(webkit, moz, 等等)来替换上面CSS中的 vendor

相关文章
相关标签/搜索