zoukankan      html  css  js  c++  java
  • 美化版复选框

    注:需要引用jq

    css部分

    .checkboxWrapper input[type="checkbox"] {
    display: none;
    }

    .checkboxWrapper input[type="checkbox"] + label {
    cursor: pointer;
    display: block;
    }

    .checkboxWrapper input[type="checkbox"] + label i {
    display: inline-block;
    vertical-align: middle;
    }

    .checkboxWrapper input[type="checkbox"] + label path {
    stroke-dashoffset: -189;
    stroke: inherit;
    stroke-dasharray: 189;
    transition: all ease-in-out 0.5s;
    -webkit-transition: all ease-in-out 0.5s;
    -moz-transition: all ease-in-out 0.5s;
    -ms-transition: all ease-in-out 0.5s;
    -o-transition: all ease-in-out 0.5s;
    }

    .checkboxWrapper input[type="checkbox"]:checked + label path {
    stroke-dashoffset: 0;
    }
    /*----------------------Themes------------------------*/
    /* Turquoise theme */
    .theme1 {
    stroke: #1ABC9C;
    }
    /**/

    /* Emerald theme */
    .theme2 {
    stroke: #2ECC71;
    }
    /**/

    js部分:

    $(function () {
    $("#btndayin").click(function () {
    $("input[type='checkbox']:checked").each(function () {
    var a = $(this).val();
    alert(a);
    });
    });
    });

    html部分:

    <div class="checkboxWrapper theme1">
    <input type="checkbox" id="sample1" value="1">
    <label for="sample1">
    <i>
    <svg version="1.1" id="Layer_1" x="0px" y="0px"
    width="50px" height="50px" viewBox="0 0 50 50" enable-background="new 0 0 50 50" xml:space="preserve">
    <circle fill="none" stroke="#B7B7B7" stroke-width="3" stroke-miterlimit="10" cx="25.11" cy="24.883" r="23.519" />
    <path fill="none" stroke-width="3" stroke-miterlimit="10" d="M48.659,25c0,12.998-10.537,23.534-23.534,23.534
    S1.591,37.998,1.591,25S12.127,1.466,25.125,1.466c9.291,0,17.325,5.384,21.151,13.203L19,36l-9-14" />
    </svg>
    </i>
    选项一
    </label>
    </div>
    <div class="checkboxWrapper theme2">
    <input type="checkbox" id="sample2" value="2">
    <label for="sample2">
    <i>
    <svg version="1.1" id="Svg1" x="0px" y="0px"
    width="50px" height="50px" viewBox="0 0 50 50" enable-background="new 0 0 50 50" xml:space="preserve">
    <circle fill="none" stroke="#B7B7B7" stroke-width="3" stroke-miterlimit="10" cx="25.11" cy="24.883" r="23.519" />
    <path fill="none" stroke-width="3" stroke-miterlimit="10" d="M48.659,25c0,12.998-10.537,23.534-23.534,23.534
    S1.591,37.998,1.591,25S12.127,1.466,25.125,1.466c9.291,0,17.325,5.384,21.151,13.203L19,36l-9-14" />
    </svg>
    </i>
    选项二
    </label>
    </div>
    <input type="button" value="dayin" id="btndayin" />

    界面如图:

  • 相关阅读:
    【JDK8特性】Stream接口详解
    【JDK8特性】Optional包装类详解
    【JDK8特性】lambda表达式详解
    关闭windows defender 扫描目录
    IIS服务启动提示当文件已存在时,无法创建该文件,183(转载)
    java部署到ubuntu
    设计模式之模板模式
    Aop示例之注解切面方式实现日志打印
    多线程实现生产消费模式
    关于linux-centos 7.x中使用xfreerdp命令去连接windows主机的远程桌面
  • 原文地址:https://www.cnblogs.com/ITzhangyunpeng/p/9295930.html
Copyright © 2011-2022 走看看