jquery数字动画插件animationCounter.js

animationCounter.js是一款小巧的数字动画jquery插件。该jquery数字动画插件可以将数字以动画的方式从一个值变化到另外一个值。它使用简单,兼容ie8浏览器,非常实用。

安装

可以通过bower来安装animationCounter.js 插件。

bower install animationCounter.js              
                

使用方法

在页面中引入jquery和animationCounter.js文件。

<script src="js/jquery.min.js"></script>
<script src="js/animationCounter.js"></script>
                
初始化插件

在你需要制作数字动画的容器上调用animationCounter()方法,就可以初始化该数字动画插件。

$('yourdiv').animationCounter();      
                

也可以在初始化时传入一些配置参数:

$('yourdiv').animationCounter({
  start: 0,
  end: 500,
  step: 1,
  delay: 1000,
  txt: ' €'
});                 
                

配置参数

该jquery数字动画插件的可用配置参数如下:

参数 类型 默认值 描述
start integer 0 数字动画开始的数值。
end integer null 数字动画结束的数值。
step integer 1 数字动画的步长。
delay integer 1000 数字跳动的时间间隔,单位毫秒。
txt string '' 数字动画结束之后显示的文字。

animationCounter.js数字动画插件的github地址为:https://github.com/mpavade/animationCounter.js

在线预览    源码下载

爱编程-编程爱好者经验分享平台
版权所有 爱编程 © Copyright 2012. All Rights Reserved.
闽ICP备12017094号-3