WowJS:在滚动页面时添加动画效果的简单实现 分享到

添加时间:17-06-12 所属分类:HTML网页,JS语言与代码
  http://ourjs.com/detail/558fdaee20cbb7f655000012

通过 WOW.js ,可以在向下滚动的过程中逐渐释放这些动画效果。

默认情况下,当你向下滚动页面时,可以逐渐展示出 CSS 动画。它一般使用 animate.css 的动画效果。但是,您可以轻松设置成您喜欢的动画库。

优点

比其他 JavaScript 视觉插件更轻量级,像 Scrollorama (这个太重了,其实我们的需求都是非常简单的)

超简单的安装,与 animate.css 配合,只需几行代码即可。

简单使用

HTML

当滚动到这两个secion时,其会分别从左/右滚出。

[code]<section class="wow slideInLeft"></section>
<section class="wow slideInRight"></section>[/code]

JavaScript

[code]new WOW().init();[/code]

高级应用

可以改变标志class,默认为 'wow',动画速度等

HTML
[code]<section class="wow slideInLeft" data-wow-duration="2s" data-wow-delay="5s"></section>
<section class="wow slideInRight" data-wow-offset="10" data-wow-iteration="10"></section>
[/code]

JavaScript
[code]
var wow = new WOW({
boxClass: 'wow', // animated element css class (default is wow)
animateClass: 'animated', // animation css class (default is animated)
offset: 0, // distance to the element when triggering the animation (default is 0)
mobile: true, // trigger animations on mobile devices (default is true)
live: true, // act on asynchronously loaded content (default is true)
callback: function(box) {
// the callback is fired every time an animation is started
// the argument that is passed in is the DOM node being animated
}
});
wow.init();[/code]

项目地址: https://github.com/matthieua/WOW
DEMO地址:http://mynameismatthieu.com/WOW/

前篇:24小时不打烊的心灵鸡汤店 后篇:WOW.js – 让页面滚动更有趣
发表我的评论


推荐文章   他是耶鲁高材生,却拿千元月薪 在小山村...   济南八旬夫妻携手半世纪:精心经营每个...   印度演员阿米尔汗减肥视频播放两千万次...   清华附小校长肺腑之言:想让孩子成功,...   产假、痛经假最新规定 这些女职工福利6...
随机文章   JS Window.Open 打开窗口详解   实用工具或者组件、框架及类库   防止别人另存网页   JavaScript程序员必备的5个debug技巧   几种常见的JavaScript混淆和反混淆工具
广告

其他推荐

因为本站所有内容均转载自其它媒体,本意为公众提供免费服务,但并不代表本网赞同其观点,也不能对其真实性验证负责,如稿件版权单位或个人不想在本网发布,请与我联系,本人会立即将其撤除,谢谢.联系方式:atseashawk@163.com QQ:99289555