Toggle navigation
在线编辑器
在线代码
文本比较
jQuery下载
前端库
在线手册
登录/注册
下载代码
html
css
js
分享到微信朋友圈
X
html
css
.plane-switch { --dot: #fff; --street: #6B6D76; --street-line: #A8AAB4; --street-line-mid: #C0C2C8; --sky-1: #60A7FA; --sky-2: #2F8EFC; --light-1: rgba(255, 233, 0, 1); --light-2: rgba(255, 233, 0, .3); cursor: pointer; -webkit-tap-highlight-color: transparent; } .plane-switch input { display: none; } .plane-switch input + div { -webkit-mask-image: -webkit-radial-gradient(white, black); position: relative; overflow: hidden; width: 50px; height: 25px; padding: 1px; border-radius: 13px; background: linear-gradient(90deg, var(--street) 0%, var(--street) 25%, var(--sky-1) 75%, var(--sky-2) 100%) left var(--p, 0%) top 0; background-position-x: var(--p, 0%); background-size: 400% auto; transition: background-position .6s; } .plane-switch input + div:before, .plane-switch input + div:after { content: ''; display: block; position: absolute; -webkit-transform: translateX(var(--s, 0)); transform: translateX(var(--s, 0)); transition: -webkit-transform .3s; transition: transform .3s; transition: transform .3s, -webkit-transform .3s; } .plane-switch input + div:before { width: 42px; right: 2px; top: 4px; height: 1px; background: var(--street-line); box-shadow: 0 16px 0 0 var(--street-line); } .plane-switch input + div:after { width: 2px; height: 2px; border-radius: 50%; left: 23px; top: 1px; -webkit-animation: lights 2s linear infinite; animation: lights 2s linear infinite; box-shadow: inset 0 0 0 2px var(--light-1), 0 21px 0 var(--light-1), 8px 0 0 var(--light-2), 8px 21px 0 var(--light-2), 16px 0 0 var(--light-2), 16px 21px 0 var(--light-2); } .plane-switch input + div span { display: block; position: absolute; } .plane-switch input + div span.street-middle { top: 12px; left: 21px; width: 3px; height: 1px; -webkit-transform: translateX(var(--s, 0)); transform: translateX(var(--s, 0)); background: var(--street-line-mid); box-shadow: 5px 0 0 var(--street-line-mid), 10px 0 0 var(--street-line-mid), 15px 0 0 var(--street-line-mid), 20px 0 0 var(--street-line-mid), 25px 0 0 var(--street-line-mid); transition: -webkit-transform .3s; transition: transform .3s; transition: transform .3s, -webkit-transform .3s; } .plane-switch input + div span.cloud { width: 12px; height: 4px; border-radius: 2px; background: #fff; position: absolute; top: var(--ct, 8px); left: 100%; opacity: var(--co, 0); transition: opacity .3s; -webkit-animation: clouds 2s linear infinite var(--cd, 0s); animation: clouds 2s linear infinite var(--cd, 0s); } .plane-switch input + div span.cloud:before, .plane-switch input + div span.cloud:after { content: ''; position: absolute; -webkit-transform: translateX(var(--cx, 0)); transform: translateX(var(--cx, 0)); border-radius: 50%; width: var(--cs, 5px); height: var(--cs, 5px); background: #fff; bottom: 1px; left: 1px; } .plane-switch input + div span.cloud:after { --cs: 6px; --cx: 4px; } .plane-switch input + div span.cloud.two { --ct: 20px; --cd: 1s; opacity: var(--co-2, 0); } .plane-switch input + div div { display: table; position: relative; z-index: 1; padding: 5px; border-radius: 50%; background: var(--dot); -webkit-transform: translateX(var(--x, 0)); transform: translateX(var(--x, 0)); transition: -webkit-transform 0.6s cubic-bezier(0.2, 0.8, 0.35, 1.2); transition: transform 0.6s cubic-bezier(0.2, 0.8, 0.35, 1.2); transition: transform 0.6s cubic-bezier(0.2, 0.8, 0.35, 1.2), -webkit-transform 0.6s cubic-bezier(0.2, 0.8, 0.35, 1.2); } .plane-switch input + div div svg { width: 13px; height: 13px; display: block; color: var(--c, var(--street)); transition: color .6s; } .plane-switch input:checked + div { --p: 100%; --x: 25px; --s: -50px; --c: var(--sky-2); --co: .8; --co-2: .6; } @-webkit-keyframes lights { 20%, 30% { box-shadow: inset 0 0 0 2px var(--light-2), 0 21px 0 var(--light-2), 8px 0 0 var(--light-1), 8px 21px 0 var(--light-1), 16px 0 0 var(--light-2), 16px 21px 0 var(--light-2); } 55%, 65% { box-shadow: inset 0 0 0 2px var(--light-2), 0 21px 0 var(--light-2), 8px 0 0 var(--light-2), 8px 21px 0 var(--light-2), 16px 0 0 var(--light-1), 16px 21px 0 var(--light-1); } 90%, 100% { box-shadow: inset 0 0 0 2px var(--light-1), 0 21px 0 var(--light-1), 8px 0 0 var(--light-2), 8px 21px 0 var(--light-2), 16px 0 0 var(--light-2), 16px 21px 0 var(--light-2); } } @keyframes lights { 20%, 30% { box-shadow: inset 0 0 0 2px var(--light-2), 0 21px 0 var(--light-2), 8px 0 0 var(--light-1), 8px 21px 0 var(--light-1), 16px 0 0 var(--light-2), 16px 21px 0 var(--light-2); } 55%, 65% { box-shadow: inset 0 0 0 2px var(--light-2), 0 21px 0 var(--light-2), 8px 0 0 var(--light-2), 8px 21px 0 var(--light-2), 16px 0 0 var(--light-1), 16px 21px 0 var(--light-1); } 90%, 100% { box-shadow: inset 0 0 0 2px var(--light-1), 0 21px 0 var(--light-1), 8px 0 0 var(--light-2), 8px 21px 0 var(--light-2), 16px 0 0 var(--light-2), 16px 21px 0 var(--light-2); } } @-webkit-keyframes clouds { 97% { -webkit-transform: translateX(-72px); transform: translateX(-72px); visibility: visible; } 98%, 100% { visibility: hidden; } 99% { -webkit-transform: translateX(-72px); transform: translateX(-72px); } 100% { -webkit-transform: translateX(0); transform: translateX(0); } } @keyframes clouds { 97% { -webkit-transform: translateX(-72px); transform: translateX(-72px); visibility: visible; } 98%, 100% { visibility: hidden; } 99% { -webkit-transform: translateX(-72px); transform: translateX(-72px); } 100% { -webkit-transform: translateX(0); transform: translateX(0); } } html { box-sizing: border-box; -webkit-font-smoothing: antialiased; } * { box-sizing: inherit; } *:before, *:after { box-sizing: inherit; } body { min-height: 100vh; display: flex; font-family: 'Roboto', Arial; justify-content: center; align-items: center; flex-direction: column; background: #2F7E5D; } body .plane-switch { margin: 12px 0; } body .dribbble { position: fixed; display: block; right: 20px; bottom: 20px; } body .dribbble img { display: block; height: 28px; } body .twitter { position: fixed; display: block; right: 64px; bottom: 14px; } body .twitter svg { width: 32px; height: 32px; fill: #1da1f2; }
JavaScript
粒子
时间
文字
hover
canvas
3d
游戏
音乐
火焰
水波
轮播图
鼠标跟随
动画
css
加载动画
导航
菜单
按钮
滑块
tab
弹出层
统计图
svg
×
Close
在线代码下载提示
开通在线代码永久免费下载,需支付20jQ币
开通后,在线代码模块中所有代码可终身免费下!
您已开通在线代码永久免费下载,关闭提示框后,点下载代码可直接下载!
您已经开通过在线代码永久免费下载
对不起,您的jQ币不足!可通过发布资源 或
直接充值获取jQ币
取消
开通下载
<!doctype html> <html> <head> <meta charset="utf-8"> <title>CSS动画开关-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号