Toggle navigation
在线编辑器
在线代码
文本比较
jQuery下载
前端库
在线手册
登录/注册
下载代码
html
css
js
分享到微信朋友圈
X
html
css
.wrapper{ display: -webkit-box; display: -ms-flexbox; display: flex; width: 400px; margin: 50vh auto 0; -ms-flex-wrap: wrap; flex-wrap: wrap; -webkit-transform: translateY(-50%); transform: translateY(-50%); } .switch_box{ display: -webkit-box; display: -ms-flexbox; display: flex; max-width: 200px; min-width: 200px; height: 200px; -webkit-box-pack: center; -ms-flex-pack: center; justify-content: center; -webkit-box-align: center; -ms-flex-align: center; align-items: center; -webkit-box-flex: 1; -ms-flex: 1; flex: 1; } /* Switch 1 Specific Styles Start */ .box_1{ background: #eee; } input[type="checkbox"].switch_1{ font-size: 30px; -webkit-appearance: none; -moz-appearance: none; appearance: none; width: 3.5em; height: 1.5em; background: #ddd; border-radius: 3em; position: relative; cursor: pointer; outline: none; -webkit-transition: all .2s ease-in-out; transition: all .2s ease-in-out; } input[type="checkbox"].switch_1:checked{ background: #0ebeff; } input[type="checkbox"].switch_1:after{ position: absolute; content: ""; width: 1.5em; height: 1.5em; border-radius: 50%; background: #fff; -webkit-box-shadow: 0 0 .25em rgba(0,0,0,.3); box-shadow: 0 0 .25em rgba(0,0,0,.3); -webkit-transform: scale(.7); transform: scale(.7); left: 0; -webkit-transition: all .2s ease-in-out; transition: all .2s ease-in-out; } input[type="checkbox"].switch_1:checked:after{ left: calc(100% - 1.5em); } /* Switch 1 Specific Style End */ /* Switch 2 Specific Style Start */ .box_2{ background: #666; } input[type="checkbox"].switch_2{ -webkit-appearance: none; -moz-appearance: none; appearance: none; width: 100px; height: 8px; background: #444; border-radius: 5px; position: relative; outline: 0; cursor: pointer; } input[type="checkbox"].switch_2:before, input[type="checkbox"].switch_2:after{ position: absolute; content: ""; -webkit-transition: all .25s; transition: all .25s; } input[type="checkbox"].switch_2:before{ width: 40px; height: 40px; background: #ccc; border: 5px solid #666; border-radius: 50%; top: 50%; left: 0; -webkit-transform: translateY(-50%); transform: translateY(-50%); } input[type="checkbox"].switch_2:after{ width: 30px; height: 30px; background: #666; border-radius: 50%; top: 50%; left: 10px; -webkit-transform: scale(1) translateY(-50%); transform: scale(1) translateY(-50%); -webkit-transform-origin: 50% 50%; transform-origin: 50% 50%; } input[type="checkbox"].switch_2:checked:before{ left: calc(100% - 35px); } input[type="checkbox"].switch_2:checked:after{ left: 75px; -webkit-transform: scale(0); transform: scale(0); } /* Switch 2 Specific Style End */ /* Switch 3 Specific Style Start */ .box_3{ background: #19232b; } .toggle_switch{ width: 100px; height: 45px; position: relative; } input[type="checkbox"].switch_3{ -webkit-appearance: none; -moz-appearance: none; appearance: none; position: absolute; top: 0; right: 0; bottom: 0; left: 0; width: 100%; height: 100%; cursor: pointer; outline: 0; z-index: 1; } svg.checkbox .outer-ring{ stroke-dasharray: 375; stroke-dashoffset: 375; -webkit-animation: resetRing .35s ease-in-out forwards; animation: resetRing .35s ease-in-out forwards; } input[type="checkbox"].switch_3:checked + svg.checkbox .outer-ring{ -webkit-animation: animateRing .35s ease-in-out forwards; animation: animateRing .35s ease-in-out forwards; } input[type="checkbox"].switch_3:checked + svg.checkbox .is_checked{ opacity: 1; -webkit-transform: translateX(0) rotate(0deg); transform: translateX(0) rotate(0deg); } input[type="checkbox"].switch_3:checked + svg.checkbox .is_unchecked{ opacity: 0; -webkit-transform: translateX(-200%) rotate(180deg); transform: translateX(-200%) rotate(180deg); } svg.checkbox{ position: absolute; top: 0; right: 0; bottom: 0; left: 0; width: 100%; height: 100%; } svg.checkbox .is_checked{ opacity: 0; fill: yellow; -webkit-transform-origin: 50% 50%; transform-origin: 50% 50%; -webkit-transform: translateX(200%) rotate(45deg); transform: translateX(200%) rotate(45deg); -webkit-transition: all .35s; transition: all .35s; } svg.checkbox .is_unchecked{ opacity: 1; fill: #fff; -webkit-transform-origin: 50% 50%; transform-origin: 50% 50%; -webkit-transform: translateX(0) rotate(0deg); transform: translateX(0) rotate(0deg); -webkit-transition: all .35s; transition: all .35s; } @-webkit-keyframes animateRing{ to{ stroke-dashoffset: 0; stroke: #b0aa28; } } @keyframes animateRing{ to{ stroke-dashoffset: 0; stroke: #b0aa28; } } @-webkit-keyframes resetRing{ to{ stroke-dashoffset: 0; stroke: #233043; } } @keyframes resetRing{ to{ stroke-dashoffset: 0; stroke: #233043; } } /* Switch 3 Specific Style End */ /* Switch 4 Specific Style Start */ .box_4{ background: #eee; } .input_wrapper{ width: 80px; height: 40px; position: relative; cursor: pointer; } .input_wrapper input[type="checkbox"]{ width: 80px; height: 40px; cursor: pointer; -webkit-appearance: none; -moz-appearance: none; appearance: none; background: #315e7f; border-radius: 2px; position: relative; outline: 0; -webkit-transition: all .2s; transition: all .2s; } .input_wrapper input[type="checkbox"]:after{ position: absolute; content: ""; top: 3px; left: 3px; width: 34px; height: 34px; background: #dfeaec; z-index: 2; border-radius: 2px; -webkit-transition: all .35s; transition: all .35s; } .input_wrapper svg{ position: absolute; top: 50%; -webkit-transform-origin: 50% 50%; transform-origin: 50% 50%; fill: #fff; -webkit-transition: all .35s; transition: all .35s; z-index: 1; } .input_wrapper .is_checked{ width: 18px; left: 18%; -webkit-transform: translateX(190%) translateY(-30%) scale(0); transform: translateX(190%) translateY(-30%) scale(0); } .input_wrapper .is_unchecked{ width: 15px; right: 10%; -webkit-transform: translateX(0) translateY(-30%) scale(1); transform: translateX(0) translateY(-30%) scale(1); } /* Checked State */ .input_wrapper input[type="checkbox"]:checked{ background: #23da87; } .input_wrapper input[type="checkbox"]:checked:after{ left: calc(100% - 37px); } .input_wrapper input[type="checkbox"]:checked + .is_checked{ -webkit-transform: translateX(0) translateY(-30%) scale(1); transform: translateX(0) translateY(-30%) scale(1); } .input_wrapper input[type="checkbox"]:checked ~ .is_unchecked{ -webkit-transform: translateX(-190%) translateY(-30%) scale(0); transform: translateX(-190%) translateY(-30%) scale(0); } /* Switch 4 Specific Style End */
JavaScript
粒子
时间
文字
hover
canvas
3d
游戏
音乐
火焰
水波
轮播图
鼠标跟随
动画
css
加载动画
导航
菜单
按钮
滑块
tab
弹出层
统计图
svg
×
Close
在线代码下载提示
开通在线代码永久免费下载,需支付20jQ币
开通后,在线代码模块中所有代码可终身免费下!
您已开通在线代码永久免费下载,关闭提示框后,点下载代码可直接下载!
您已经开通过在线代码永久免费下载
对不起,您的jQ币不足!可通过发布资源 或
直接充值获取jQ币
取消
开通下载
<!doctype html> <html> <head> <meta charset="utf-8"> <title>自定义复选框/开关切换-jq22.com</title> <script src="https://www.jq22.com/jquery/jquery-1.10.2.js"></script> <style>
</style> </head> <body>
<script>
</script>
</body> </html>
2012-2021 jQuery插件库版权所有
jquery插件
|
jq22工具库
|
网页技术
|
广告合作
|
在线反馈
|
版权声明
沪ICP备13043785号-1
浙公网安备 33041102000314号