Switch按钮
2024-09-04 22:01:10
使用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>
效果:
最新文章
- SQL Server 通过备份文件初始化复制
- Spring 4支持的Java 8新特性一览
- treetable 前台 累计计算树值 提交后台
- TokuDB 引擎安装测试
- C++隐藏规则
- IOS之资源收集--很好的github网址
- Android 进度条
- POJ-3140 Contestants Division (树)
- [Yii2]Unable to verify your data submission(你提交的资料无法被验证)
- Connecting Docker for Cloud Services using SDN and Network Virtualization
- 论文笔记(5):Fully Convolutional Multi-Class Multiple Instance Learning
- 手机app抓包
- Golang并发编程进程通信channel了解及简单使用
- Centos 6.5 搭建阿里云yum源
- ASP 基础一
- 深入理解java内存模型
- linux 常用命令-配置登陆方式
- 软工实践-Alpha 冲刺 (7/10)
- wechat talk
- NOIP模拟2017.6.11解题报告
热门文章
- 51nod1050 循环数组最大子段和
- Android开发环境搭建(eclipse版)
- 【ARM-Linux开发】Linux下更改目录下所有文件的所有者及其权限
- 最新 人民网java校招面经 (含整理过的面试题大全)
- Redis 根据Key模糊批量查询数据
- POJ 2195 Going Home 【最小费用最大流】
- [Arc102B]All Your Paths are Different Lengths_构造_二进制拆分
- 自动输入密码执行远程服务器上的java -version命令
- Scrapy setup.py 各参数详解
- python学习-3 python基础-1基础知识和解释器