jquery 数字滚动方法

烂漫一生 提交于 2019-12-04 10:53:40

jquery 数字滚动方法
用的是countUp.js这个插件

 

target = 目标元素的 ID;
startVal = 开始值;
endVal = 结束值;
decimals = 小数位数,默认值是0;
duration = 动画延迟秒数,默认值是2;


1先初始化
<pre>
var options = {  
useEasing: true,
  useGrouping: false,
  separator: ',',
  decimal: '.',
};
var demo = new CountUp('few', 0, 0, 0, 0.5, options);
if (!demo.error) {  
demo.start();
} else {  
console.error(demo.error);
}
</pre>
2更新
<pre>
demo.update(6000);
</pre>

 

详细参数看http://inorganik.github.io/countUp.js/

 

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!