zoukankan      html  css  js  c++  java
  • 环形进度条

    .circle {
                 80px;
                height: 80px;
                position: relative;
                border-radius: 50%;
                margin: 0 auto;
                background: rgba(237, 113, 97, 1);
            }
    
            .pie_left, .pie_right {
                 80px;
                height: 80px;
                position: absolute;
                top: 0;
                left: 0;
            }
    
            .left, .right {
                display: block;
                 80px;
                height: 80px;
                background: rgba(205, 235, 255, 1);
                border-radius: 50%;
                position: absolute;
                top: 0;
                left: 0;
            }
    
            .pie_right, .right {
                clip: rect(0,auto,auto,40px);
            }
    
            .pie_left, .left {
                clip: rect(0,40px,auto,0);
            }
    
            .mask {
                 76px;
                height: 76px;
                border-radius: 50%;
                left: 2px;
                top: 2px;
                background: rgba(52,151,216,1);
                position: absolute;
                text-align: center;
                line-height: 76px;
                font-size: 16px;
                color: #FFFFFF;
            }
    css
    <div class="circle" id="errorProportion">
      <div class="pie_left">
            <div class="left"></div>
      </div>
      <div class="pie_right">
            <div class="right"></div>
      </div>
       <div class="mask">
        <span data-proportion="0">0</span>
     </div>
    </div>
    HTML代码
    $.extend({
     rings:function($ringId,$ringColor){
                $('#'+$ringId).each(function(index, el) {
                    var num = $(this).find('span').attr('data-proportion') * 3.6;
                    $(this).css('background',$ringColor);
                    if (num<=180) {
                        $(this).find('.right').css('transform', "rotate(" + num + "deg)");
                        $(this).find('.left').css('transform', "rotate(0deg)");
                    } else {
                        $(this).find('.right').css('transform', "rotate(180deg)");
                        $(this).find('.left').css('transform', "rotate(" + (num - 180) + "deg)");
                    };
                });
            }
    })
    Jquery代码
                $.rings('correctProportion','rgba(137, 192, 89, 1)');
    调用
  • 相关阅读:
    封装异常处理之坑
    30multipart/form-data和application/x-www-form-urlencoded的区别(二)urlencoded之自动deocde
    使用MAT时的Shallow Size和 Retained Size的区别
    当动态代理遇到ioc
    线程池的原理
    synchroned原理与对象头(yet)
    mysql压力测试与qps监控
    一种mysql jvm死锁
    Android Jni变量对照表
    结构体中使用函数指针
  • 原文地址:https://www.cnblogs.com/NigelShi/p/4882981.html
Copyright © 2011-2022 走看看