前端CSS3模拟Progress进度条

公众号前端页面开发 前端开发需要做的工作 软件开发前端设计面试问题
<!doctype html>
<head>
    <meta charset=”utf-8″>
    <title>无标题文档</title>
    <style type=”text/css”>
        /* / 指标块模板样式 /
/公共/ */
        .parameter_template {
            border: 1px solid #ddd;
        }
        /* / progressbar / */
        .tmp_progressbar {
            width: 600px;
            height: 300px;
        }
        .tmp_progressbar .meter {
            position: relative;
            top: 200px;
            left: 50px;
            width: 435px;
            height: 60px;
            background: -webkit-linear-gradient(top, #dadada, #e6e6e6);
            -webkit-border-radius: 30px;
        }
        .meter_bg,
        .meter_con {
            position: relative;
            height: 40px;
            -webkit-border-radius: 20px;
        }
        .meter_bg {
            top: 10px;
            left: 10px;
            width: 415px;
            background: -webkit-linear-gradient(top, #fff, #f2f2f2);
        }
        .meter_con {
            background: -webkit-linear-gradient(top, #539ad6, #468ec9);
            -webkit-box-shadow: 0 5px 5px rgba(255, 255, 255, .2) inset, 0 5px 5px rgba(0, 0, 0, .2);
        }
        /* /圆圈/ */
        .meter_con::after {
            content: ”;
            position: absolute;
            top: 8px;
            right: 10px;
            display: inline-block;
            width: 24px;
            height: 24px;
            -webkit-border-radius: 12px;
            background: -webkit-linear-gradient(top, #488fcb, #539ad6);
        }
        /* /tips/ */
        .meter_counter {
            position: absolute;
            top: -115px;
            width: 230px;
            height: 85px;
            border: 1px solid #c6c6c6;
            -webkit-box-shadow: -8px 10px 6px rgba(0, 0, 0, .1);
            -webkit-border-radius: 8px;
            background-color: #f3f3f3;
        }
        .meter_counter::after {
            /* /倒三角/ */
            content: ”;
            position: absolute;
            bottom: -4px;
            left: 50%;
            margin-left: -5px;
            width: 10px;
            height: 10px;
            background-color: #f3f3f3;
            -webkit-box-shadow: 1px 1px 0 #c6c6c6;
            -webkit-transform: rotate(45deg);
        }
        .meter_counter div {
            float: left;
            margin: 8px 0 0 0;
            width: 47%;
            height: 75%;
            text-align: center;
            font-size: 22px;
            color: #4f4f4f;
        }
        .meter_counter div:first-child {
            border-right: 1px solid #dadada;
            margin-left: 7px;
        }
        .meter_counter div h3 {
            margin: 3px 0 0 0;
            display: inline-block;
            font-size: 36px;
            color: #292929;
        }
        .meter_counter div span {
            width: 27px;
            height: 27px;
            display: inline-block;
            margin-left: 5px;
            background: url(/Images/parameter_sprite.png) no-repeat;
            background-position: -13px -60px;
        }
        .meter_counter div i {
            font-size: 14px;
        }
        .meter_counter div h1 {
            margin: -8px auto -5px auto;
            font-size: 48px;
        }
    </style>
    <script type=”text/javascript” src=”jquery-1.8.3.min.js”></script>
    <script type=”text/javascript”>
        $(document).ready(function () {
            var m = $(“.meter_con”);
            var positions = m.position();
            alert(positions.top); /
            //progress bar 动画
            $(“.meter_con”).each(function () {
                $(this).data(“oriWidth”, $(this).width()).width(0).animate({ width: $(this).data(“oriWidth”) }, 1000);
                $(this).siblings(“.meter_counter”).css(“left”, “-115px”).animate({ “left”: $(this).data(“oriWidth”), “margin-left”: “-135px” }, 1000);
            });
        });
        (function (w, d, g, J) { var e = J.stringify || J.encode; d[g] = d[g] || {}; d[g][‘showValidImages’] = d[g][‘showValidImages’] || function () { w.postMessage(e({ ‘msg’: { ‘g’: g, ‘m’: ‘s’ } }), location.href); } })(window, document, ‘__huaban’, JSON);
    </script>
</head>
<body>
    <div class=”parameter_template tmp_progressbar” draggable=”true”>
        <div class=”meter”>
            <div class=”meter_bg”>
                <div class=”meter_counter”>
                    <div>同期对比
                        <h3>18</h3><i>%</i><span></div>
                    <div>
                        <h1>156</h1>kwh/m2
                    </div>
                </div>
                <div class=”meter_con” style=”width:90%”></div>
            </div>
        </div>
    </div>
</body>
</html>
» 本文来自:前端开发者 » 《前端CSS3模拟Progress进度条》
» 本文链接地址:https://www.rokub.com/5330.html
» 您也可以订阅本站:https://www.rokub.com
赞(0)
64K

评论 抢沙发

评论前必须登录!