css_animate动画

一、首先引入animate css文件css

<head>
  <link rel="stylesheet" href="animate.min.css">
</head>

二、给指定的元素加上指定的动画样式名jquery

<div class="animated bounceOutLeft"></div>

这里包括两个class名,第一个是基本的,必须添加的样式名,任何想实现的元素都得添加这个。第二个是指定的动画样式名。 
三、若是说想给某个元素动态添加动画样式,能够经过jquery来实现:web

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

animate.css 的默认设置也许有些时候并非咱们想要的,因此你能够从新设置,好比:动画

四、当动画效果执行完成后还能够经过如下代码添加事件spa

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

你也能够经过 JavaScript 或 jQuery 给元素添加这些 class,好比:code

$(function(){
    $('#jq22').addClass('animated bounce');
});

有些动画效果最后会让元素不可见,好比淡出、向左滑动等等,可能你又须要将 class 删除,好比:blog

$(function(){
    $('#jq22').addClass('animated bounce');
    setTimeout(function(){
        $('#jq22').removeClass('bounce');
    }, 1000);
});

animate.css 的默认设置也许有些时候并非咱们想要的,因此你能够从新设置,好比:事件

#jq22{
    animate-duration: 2s;    //动画持续时间
    animate-delay: 1s;    //动画延迟时间
    animate-iteration-count: 2;    //动画执行次数
}
相关文章
相关标签/搜索