js实现数字滚动效果

 

Html结构:

<div id="numRoll" class="myroll"></div>

Js代码:

<script type="text/javascript">
    var mynroll=518518;
    var r1=new DigitRoll({
        container:'#numRoll',
        width:8
    });
    r1.roll(mynroll);
    //随机跑跑
    setInterval(function () {
        mynroll+=parseInt(Math.random()*100)
        r1.roll(mynroll)
    },3000)
</script>

在线预览效果:http://yiyifly.com/demo/digitroll/digitroll.html

评论

还没有评论...留下你的评论!

Leave a Reply

Your email address will not be published. Required fields are marked *

Sidebar