Toggle navigation
在线编辑器
在线代码
文本比较
jQuery下载
前端库
在线手册
登录/注册
下载代码
html
css
js
分享到微信朋友圈
X
html
Debug
css
html, body { width: 100vw; height: 100vh; padding: 0; margin: 0; background-color: #121314; } input { display: none; } .grid { display: grid; grid-template-rows: 1fr 1fr; grid-template-columns: 1fr 1fr; width: 100vw; height: 100vh; position: absolute; } .grid>* { position: relative; } label { display: block; cursor: pointer; position: absolute; width: 50vw; height: 50vw; max-width: 150px; max-height: 150px; } @media (min-aspect-ratio: 1/1) { label { width: 50vh; height: 50vh; } } .menu--1 label, .menu--2 label { bottom: 0; } .menu--3 label, .menu--4 label { top: 0; } .menu--1 label, .menu--3 label { right: 0; } .menu--2 label, .menu--4 label { left: 0; } path { fill: none; stroke: #ffffff; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; --length: 24; --offset: -38; stroke-dasharray: var(--length) var(--total-length); stroke-dashoffset: var(--offset); transition: all .8s cubic-bezier(.645, .045, .355, 1); } circle { fill: #fff3; opacity: 0; } label:hover circle { opacity: 1; } .cross input:checked+svg .line--1, .cross input:checked+svg .line--3 { --length: 22.627416998; } .cross input:checked+svg .line--2 { --length: 0; } .back input:checked+svg .line--1, .back input:checked+svg .line--3 { --length: 8.602325267; } .menu--1 { background-color: #3f77e9; } .menu--1 .line--1, .menu--1 .line--3 { --total-length: 126.64183044433594; } .menu--1 .line--2 { --total-length: 70; } .menu--1 input:checked+svg .line--1, .menu--1 input:checked+svg .line--3 { --offset: -94.1149185097; } .menu--1 input:checked+svg .line--2 { --offset: -50; } .menu--2 { background-color: #0095f9; } .menu--2 .line--1, .menu--2 .line--3 { --total-length: 111.22813415527344; --offset: -50.22813415527344; } .menu--2 .line--2 { --total-length: 99; } .menu--2 input:checked+svg path { transform: translateX(30px); } .menu--2 input:checked+svg .line--1, .menu--2 input:checked+svg .line--3 { --offset: -16.9705627485; } .menu--2 input:checked+svg .line--2 { --offset: -20; } .menu--3 { background-color: #00aef6; } .menu--3 .line--1, .menu--3 .line--3 { --total-length: 126.38166809082031; } .menu--3 .line--2 { --total-length: 80; } .menu--3 input:checked+svg .line--1, .menu--3 input:checked+svg .line--3 { --offset: -109.1770175568; } .menu--4 { background-color: #18bee5; } .menu--4 .line--1, .menu--4 .line--3 { --total-length: 103.35061645507812; --offset: -42.35061645507812; } .menu--4 .line--2 { --total-length: 99; } .menu--4 input:checked+svg path { transform: translateX(31px); } .menu--4 input:checked+svg .line--1, .menu--4 input:checked+svg .line--3 { --offset: -8.602325267; } .menu--4 input:checked+svg .line--2 { --offset: -7; } .debug { display: none; } .line--debug { display: none; opacity: .2; stroke-dasharray: none; } @media screen and (min-width: 800px) { .debug { opacity: 0.8; display: block; position: absolute; z-index: 1; font-family: sans-serif; transform: rotate(-45deg); transform-origin: 0% 100%; background: #000; color: #fff; width: 150px; height: 100px; line-height: 150px; text-align: center; user-select: none; } .debug:hover { opacity: 1; } .debug.active { background: #fff; color: #000; } .debug.active+.grid path.line--debug { display: inherit; } }
JavaScript
Array.from(document.getElementsByTagName('path')).map(function (path) { console.log(path.getTotalLength()); var debugPath = path.cloneNode(); debugPath.classList.add('line--debug'); if (path.parentNode) path.parentNode.insertBefore(debugPath.cloneNode(), path); }); var debugCheckbox = document.getElementById('debug'); debugCheckbox.addEventListener('change', function () { if (debugCheckbox.checked) { debugCheckbox.parentElement.classList.add('active'); } else { debugCheckbox.parentElement.classList.remove('active'); } }); var currentActive = 0; var checkboxes = document.querySelectorAll('.grid input'); var autoShow = setInterval(function () { checkboxes[currentActive % 4].checked = !checkboxes[currentActive % 4].checked; if (!checkboxes[currentActive % 4].checked) currentActive += 1; }, 1000); document.querySelector('.grid').addEventListener('click', function () { clearInterval(autoShow); });
粒子
时间
文字
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号