实现HTML数字滚动(2018-12-14)

实现HTML数字滚动(2018-12-14)

先来看个效果图

20181214144421709.gif

准备工作

<script src="http://cdn.bootcss.com/jquery/1.11.0/jquery.min.js" type="text/javascript"></script>

<script src="https://cdnjs.cloudflare.com/ajax/libs/waypoints/4.0.1/jquery.waypoints.min.js"></script>

 <script type="text/javascript" src="js/jquery.countup.min.js"></script>

直接上代码

<!DOCTYPE html>

<html lang="zh">

<head>

    <meta charset="UTF-8">

    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> 

    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <title>轻量级jquery数字动画插件|DEMO_jQuery之家-自由分享jQuery、html5、css3的插件库</title>

    <link rel="stylesheet" type="text/css" href="css/normalize.css" />

    <link rel="stylesheet" type="text/css" href="css/htmleaf-demo.css">

    <link href='http://fonts.googleapis.com/css?family=Pacifico' rel='stylesheet' type='text/css'>

    <style type="text/css">

        .container { margin:150px auto; max-width:480px;}

        h2,h3 { text-align:center;}

        .demo { text-align:center; margin-top:1000px;}

        span.counter { display:block; margin:20px auto; font-size:64px; font-family:'Pacifico'}

    </style>

</head>

<body>

    <div class="htmleaf-container"> 

        <div class="demo">

            <span class="counter">1,498,547.00</span>

        </div>

    </div>


    <script src="http://cdn.bootcss.com/jquery/1.11.0/jquery.min.js" type="text/javascript"></script>

    <script src="https://cdnjs.cloudflare.com/ajax/libs/waypoints/4.0.1/jquery.waypoints.min.js"></script>

    <script type="text/javascript" src="js/jquery.countup.min.js"></script>

    <script type="text/javascript">

        $('.counter').countUp();

    </script>

</body>

</html>
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • 血顺着我的头发流下来。我一只手捂着头,一边接着问:”1223号什么名字……” 血流到我的脸上了,我用手蹭了一下,仿...
    双木文阅读 400评论 1 1
  • “ 我知道时间的流逝,让我们不得不往前,但是我们总会有时间回头看,张望着过去的自己,寻找自己的芳华。 高中时期的我...
    南邮青年阅读 391评论 0 0
  • 没有defer或async属性,浏览器会立即加载并执行相应的脚本。不等待后续文档元素的加载,只要读到就开始加载和执...
    丶Pal阅读 660评论 0 1
  • 小想你想你难道你
    翔龙罗汉阅读 422评论 0 0