技术文章

WOW.js 和 animate.css – 让页面滚动更有趣

日期:2017-07-03 阅读:28717

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

http://mynameismatthieu.com/WOW/docs.html

https://github.com/matthieua/WOW    - wow.js是用来实现滚动到当前时,才animate效果。必须要的。

 

WOW.js 依赖 animate.css,所以它支持 animate.css 多达 60 多种的动画效果,能满足您的各种需求。

 
使用方法

1、引入css和wow.js文件

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


2、HTML

<div class="wow slideInLeft"></div>
<div class="wow slideInRight"></div>
可以加入 data-wow-duration(动画持续时间)和 data-wow-delay(动画延迟时间)属性,如:

<div class="wow slideInLeft" data-wow-duration="2s" data-wow-delay="5s"></div>
<div class="wow slideInRight" data-wow-offset="10"  data-wow-iteration="10"></div>

 


3、JavaScript

new WOW().init();


如果需要自定义配置,可如下使用:

var wow = new WOW({
    boxClass: 'wow',
    animateClass: 'animated',
    offset: 0,
    mobile: true,
    live: true
});
wow.init();