有的页面在向下滚动的时候,有些元素会产生细小的动画效果。虽然动画比较小,但却能吸引你的注意。如果你希望你的页面也更加有趣,那么你可以试试 WOW.js。
WOW.js 依赖 animate.css,所以它支持 animate.css 多达 60 多种的动画效果,能满足您的各种需求。
特效演示网址:http://www.jq22.com/yanshi1705
类似特效:scrollReveal.js ——页面滚动显示动画 JavaScript,不支持 IE6 - IE9
在线案例:
http://www.nmmts.com/list-37-1.html
http://www.nmmts.com/list-38-1.html
http://www.nmmts.com/list-39-1.html
使用方法
1、引入文件
<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();
配置
| 属性/方法 | 类型 | 默认值 | 说明 |
|---|---|---|---|
| boxClass | 字符串 | ‘wow’ | 需要执行动画的元素的 class |
| animateClass | 字符串 | ‘animated’ | animation.css 动画的 class |
| offset | 整数 | 0 | 距离可视区域多少开始执行动画 |
| mobile | 布尔值 | true | 是否在移动设备上执行动画 |
| live | 布尔值 | true | 异步加载的内容是否有效 |
WOW.js 是一款依赖于 animate.css 的 JavaScript 库,能够为网页元素添加丰富的滚动动画效果。支持超过60种预设动画,适用于现代浏览器,并且配置简单。本文将介绍 WOW.js 的基本用法及如何自定义配置。
1026

被折叠的 条评论
为什么被折叠?



