wow.js搭配animate.css的基本使用

<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/4.1.1/animate.min.css">
    <style>
        div{
            width: 800px;
            height: 300px;
            margin: 400px;
            background-color: #1e9fff;
        }
    </style>
</head>
<body>
<div class="wow animate__backInLeft"  data-wow-duration="5s" data-wow-delay="3s"></div>
<div class="wow animate__backInRight" data-wow-offset="100" data-wow-iteration="10"></div>
<div class="wow animate__backInUp"></div>
<div class="wow animate__fadeInUp"></div>
<script type="text/javascript" src="./animate/wow.min.js"></script>

<script>
    /**
     * wow简单使用:
     *    这里的动画选用animate.css来操作
     *    
     *    1.标签属性介绍:
     *              data-wow-duration  :动画完成所消耗的事件
     *              data-wow-delay     :动画延时多久开始执行
     *              data-wow-offset    :盒子显示多少高度后开始执行动画
     *              data-wow-iteration :动画执行的次数
     *     2.初始化属性介绍:
     *            boxClass       :什么类名的盒子需要执行动画
     *            animateClass   :需要执行的动画,的必要前缀(比如说animate.css要执行动画就要带上animate__animated + 要执行的动画类名)
     *            offset         :偏移位(和标签的那个offset一致) number
     *            mobile         :在手机上是否执行动画            true/false
     *            live           :对异步加载的内容进行操作         true/false
     *            callback       :每当某个盒子执行动画,都会执行函数 function
     *            scrollContainer:可选滚动容器选择器,否则使用窗口   盲猜传入容器唯一标识,或者直接获取容器传进去
     */
    const wow = new WOW({
        boxClass: "wow",
        animateClass: "animate__animated"
    });
    wow.init()
</script>
</body>
</html>

wow.js文档        :Reveal Animations When Scrolling — WOW.js

animate.css文档:Animate.css | A cross-browser library of CSS animations.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值