美文网首页
Animate.css的初入门

Animate.css的初入门

作者: miner敏儿 | 来源:发表于2017-04-22 20:41 被阅读0次

推荐一个网站最牛前端
Animate.css是css动画库,封装了一些动画效果想要使用的话直接在github上下载,因为是css库,所以直接使用link链入就可以了

地址
http://daneden.github.io/animate.css/

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link rel="stylesheet" href="css/animate.css">
    <style>
        div{
            width: 100px;
            height: 100px;
            background: red;
        }
    </style>
</head>
<body>
<!--醉牛前端-->
<div class="animated infinite fadeIn"></div>
</body>
</html>

动画效果的话可以直接在Animate.css中试,拿到自己想要的动画效果
在添加class时一定要写上animated 再写其他想要实现的动画,因为动画效果都是基于animated来实现的

  • 如果自己想要修改animate库里的默认属性可以在css中通过.animated修改
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link rel="stylesheet" href="css/animate.css">
    <style>
        div{
            width: 100px;
            height: 100px;
            background: red;
            margin: 30px auto;
        }
        /*我自己可以在这里修改animate库里的默认动画属性*/
        .animated {
            -webkit-animation-duration: 2s;
            animation-duration: 2s;
            -webkit-animation-fill-mode: both;
            animation-fill-mode: both;
        }
    </style>
</head>
<body>
<div class="animated slideInDown"></div>
</body>

一个小demo来加深印象

<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link rel="stylesheet" href="css/animate.css">
    <style>
        body{
            background: rgba(0,0,0,.5);
        }
        div{
            width: 300px;
            height: 300px;
            background: pink;
            margin: 100px auto;
        }
    </style>
    <script src="js/jquery-1.7.2.min.js"></script>
    <script>
        $(function() {
            $('button').on('click', function () {
                //1.增加class
                $('div').addClass('animated shake');


                //2.页面的刷新
                setTimeout(function () {
//                    window.location.reload(); //如果不加那么只能运行一次除非重新刷新页面在点击时才会有动画

                    //添加回调函数
                    //先删除再添加
//                    $('div').removeClass('shake');
//                    $('div').addClass('bounceOut');
                    $('div').removeClass('shake').addClass('bounceOut');
                }, 1000)
            })
        })
    </script>
</head>
<body>
<button>点击</button>
<div>
</div>
</body>

有两个动画效果.

相关文章

  • Animate.css的初入门

    推荐一个网站最牛前端Animate.css是css动画库,封装了一些动画效果想要使用的话直接在github上下载,...

  • 【Animate.css】CSS动画库

    本节目录 Animate.css简介 Animate.css基础用法 Animate.css配合JS的用法和讲解 ...

  • animate.css的使用方法

    animate.css介绍 animate.css是一个跨浏览器的css3动画库 animate.css基础使用 ...

  • VUE之动画特效

    1. 在vue使用animate.css库 安装:npm install animate.css --save引用...

  • CSS3的颜色渐变效果

    在 animate.css寻找自己想要的动态效果,看到标题Animate.css和按钮Animate it的颜色在...

  • 基于animate和fullpage制作动画demo的总结

    animate.css就是一个动画库,使用时注意点: 用法: Animate.css 当与jQuery...

  • vue day03

    1.transition结合animate.css实现过渡 步骤:1.引入animate.css文件2.在想要进行...

  • HTML常用框架

    框架一 :: Animate.css Animate.css是一个css动画样式库,可以减少我们的开发时间.它预设...

  • 初入门

    终于可以有一些时间静静的回顾一下那些走过的历程与曾经的那些人、那些事了。每每一个人静下来的时候,想到那些曾经令人感...

  • WOW.js – 让页面滚动更有趣

    前面提到了animate.css,在这里推荐一个能与animate.css完美结合的控件——wow.js WOW....

网友评论

      本文标题:Animate.css的初入门

      本文链接:https://www.haomeiwen.com/subject/kunszttx.html