前端: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等
最简单的使用:
<div id="my_odometer" class="odometer">0</my_odometer>
<script>
//滚动数字
setTimeout(function(){
my_odometer.innerHTML = 26004;
}, 500);
</script>
也可以自定义使用:
var el = document.querySelector('.my_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)
AtomGit 是由开放原子开源基金会联合 CSDN 等生态伙伴共同推出的新一代开源与人工智能协作平台。平台坚持“开放、中立、公益”的理念,把代码托管、模型共享、数据集托管、智能体开发体验和算力服务整合在一起,为开发者提供从开发、训练到部署的一站式体验。
更多推荐


所有评论(0)