使用CSS+HTML5修改原生checkbox为Switch Button

        .switch {
width: 45px;
height: 15px;
position: relative;
border: 1px solid #dfdfdf;
background-color: #c6cacd;
box-shadow: #dfdfdf 0 0 0 0 inset;
border-radius: 20px;
background-clip: content-box;
display: inline-block;
-webkit-appearance: none;
user-select: none;
outline: none;
}
.switch:before {
content: '';
width: 16px;
height: 15px;
position: absolute;
top: 0;
left: 0;
border-radius: 20px;
background-color: #fff;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}
.switch:checked {
border-color: #64bd63;
box-shadow: #64bd63 0 0 0 16px inset;
background-color: #64bd63;
}
.switch:checked:before {
left: 30px;
}
.switch.switch-anim {
transition: border cubic-bezier(0, 0, 0, 1) 0.4s, box-shadow cubic-bezier(0, 0, 0, 1) 0.4s;
}
.switch.switch-anim:before {
transition: left 0.3s;
}
.switch.switch-anim:checked {
box-shadow: #5fa7fb 0 0 0 16px inset;
background-color: #5fa7fb;
transition: border ease 0.4s, box-shadow ease 0.4s, background-color ease 1.2s;
}
.switch.switch-anim:checked:before {
transition: left 0.3s;
}
.switch:focus{
outline: none !important;
border: none !important;
}

  <input class="switch switch-anim" style="border:0" type="checkbox" '+ checked +' onchange="checkNum(this)"></div>

效果:

最新文章

  1. SQL Server 通过备份文件初始化复制
  2. Spring 4支持的Java 8新特性一览
  3. treetable 前台 累计计算树值 提交后台
  4. TokuDB 引擎安装测试
  5. C++隐藏规则
  6. IOS之资源收集--很好的github网址
  7. Android 进度条
  8. POJ-3140 Contestants Division (树)
  9. [Yii2]Unable to verify your data submission(你提交的资料无法被验证)
  10. Connecting Docker for Cloud Services using SDN and Network Virtualization
  11. 论文笔记(5):Fully Convolutional Multi-Class Multiple Instance Learning
  12. 手机app抓包
  13. Golang并发编程进程通信channel了解及简单使用
  14. Centos 6.5 搭建阿里云yum源
  15. ASP 基础一
  16. 深入理解java内存模型
  17. linux 常用命令-配置登陆方式
  18. 软工实践-Alpha 冲刺 (7/10)
  19. wechat talk
  20. NOIP模拟2017.6.11解题报告

热门文章

  1. 51nod1050 循环数组最大子段和
  2. Android开发环境搭建(eclipse版)
  3. 【ARM-Linux开发】Linux下更改目录下所有文件的所有者及其权限
  4. 最新 人民网java校招面经 (含整理过的面试题大全)
  5. Redis 根据Key模糊批量查询数据
  6. POJ 2195 Going Home 【最小费用最大流】
  7. [Arc102B]All Your Paths are Different Lengths_构造_二进制拆分
  8. 自动输入密码执行远程服务器上的java -version命令
  9. Scrapy setup.py 各参数详解
  10. python学习-3 python基础-1基础知识和解释器