数字滚动插件-Odometer.js使用简介

使用该插件需要引入:

<link rel="stylesheet" href="http://github.hubspot.com/odometer/themes/odometer-theme-car.css" />
<script src="http://github.hubspot.com/odometer/odometer.js"></script>

另外官方提供了几个其他主题样式如:

odometer-theme-default.css等

最简单的使用方式:

odometer.innerHTML = 456;

也可以如下使用:

var el = document.querySelector('.odometer');
            od = new Odometer({
                el: el,
                value: '00000000',
                duration: 1000,
                // Any option (other than auto and selector) can be passed in here
                format: '(,ddd).dd',
                theme: 'default',
                animation: 'count'
            });
od.update(123456)

附:官方API:http://github.hubspot.com/odometer/


猜你喜欢

转载自blog.csdn.net/qq_21132509/article/details/80089969