Toggle navigation
在线编辑器
在线代码
文本比较
jQuery下载
前端库
在线手册
登录/注册
下载代码
html
css
js
分享到微信朋友圈
X
html
home
strategy
period
security
settings
css
@import url('https://fonts.googleapis.com/css2?family=Quicksand:wght@700&display=swap'); html { box-sizing: border-box ; --duration: .45s ; --cubic: cubic-bezier(0.4, 0, 0.2, 1) ; --color-1: #d5dadd ; --color-2: #51d5c2 ; } html *, html *::before, html *::after { box-sizing: inherit ; } body { margin: 0 ; height: 100vh ; display: flex ; overflow: hidden ; align-items: center ; justify-content: center ; background-color: #f0f1f1 ; font-family: 'Quicksand', sans-serif ; } .menu { margin: 0 ; width: 42em ; display: flex ; height: 10.4em ; user-select: none ; position: relative ; align-items: center ; padding: 0 1.9em 2.5em ; justify-content: center ; background-color: #fefefe ; border-radius: 1em 1em 4.5em 4.5em ; -webkit-tap-highlight-color: transparent ; } @media (max-width: 36em) { .menu { font-size: .55em ; } } .menu::after { height: 5% ; width: 35% ; bottom: 10% ; content: " " ; position: absolute ; border-radius: 1em ; background-color: #f2f3f4 ; } .menu__item { all: unset ; flex-grow: 1 ; display: flex ; cursor: pointer ; overflow: hidden ; padding-top: 0.5em ; position: relative ; align-items: center ; color: var(--color-1) ; justify-content: center ; transition: flex-grow var(--duration) var(--cubic) ; } .menu__icon { font-size: 1.05em ; stroke: currentColor ; transition: transform var(--duration) var(--cubic) ; } .menu__item::before { top: 9% ; left: 18.4% ; width: 1.5em ; height: 1.5em ; content: " "; position: absolute ; border-radius: 50% ; transform: scale(0) ; transform-origin: center ; background-color: #fdecef ; transition: transform var(--duration) var(--cubic) ; } .menu__item::after { left: 0; bottom: 0 ; content: " " ; height: 0.25em ; position: absolute ; border-radius: 2em ; transform-origin: left center ; background-color: currentColor ; width: calc( var(--lineWidth) + 5px ) ; transform: translate3d(3em , 0, 0) scaleX(0) ; transition: transform calc( var(--duration) + .2s) var(--cubic) ; } .menu__text { left: 4.15em ; font-size: 1.5em ; position: absolute ; text-transform: capitalize ; transform: translate3d(0, 109%, 0) ; transition: transform calc( var(--duration) / 3.7 ) ; } .menu__item.active { flex-grow: 2.7 ; color: var(--color-2) ; } .menu__item.active .menu__icon { transform: translate3d(-95% , 0, 0) ; } .menu__item.active::before { transform: scale(1) ; } .menu__item.active::after { transform: translate3d(6.3em , 0, 0) scaleX(1) ; transition: transform var(--duration) var(--cubic) ; } .menu__text.active { transform: translate3d(0 , 0, 0) ; transition: transform calc(var(--duration) / 1.5) ; } .icon { --duration-icon: 1s ; fill:none ; width: 2.5em ; height: 2.5em ; display: block ; stroke-width: 15 ; stroke-miterlimit: 10 ; } .active #home-anm { animation: home var(--duration-icon) ; } @keyframes home { 25% { transform: translate3d(0, -.8em , 0) ; } 50% { transform: translate3d(0, .5em , 0) ; } } #strategy-anm { transform: scaleX(.85) ; transform-origin: center ; } .active #strategy-anm { animation: strategy var(--duration-icon) ; } @keyframes strategy { 50% { transform: scaleX(1) ; } 100%{ transform: scaleX(.85) ; } } .active #strategy-cir1 { animation: strategy-cir1 var(--duration-icon); } .active #strategy-cir2 { animation: strategy-cir2 var(--duration-icon) .1s; } .active #strategy-cir3 { animation: strategy-cir3 var(--duration-icon) .2s; } @keyframes strategy-cir1 { 50% { transform: translate3d(-.7em,-0.7em,0); } 100%{ transform: translate3d(0,0,0); } } @keyframes strategy-cir2 { 35% { transform: translate3d(0,-0.7em,0); } 100%{ transform: translate3d(0,0,0); } } @keyframes strategy-cir3 { 35% { transform: translate3d(.7em,-0.7em,0); } 100%{ transform: translate3d(0,0,0); } } .active #period-anm { transform-origin: center 100% ; animation: period var(--duration-icon) ; } .active #period-cir { transform-origin: center ; animation: period-cir var(--duration-icon) ; } .active #period-line { stroke-dasharray: 66 ; animation: period-line calc( var(--duration-icon) / 2.5 ) reverse ; } @keyframes period { 35% { transform: scaleY(.85) ; } 60% , 70% { transform: scaleY(1.2) ; } 100% { transform: scaleY(1) ; } } @keyframes period-cir { 0%{ opacity: 0 ; } 35% { opacity: 1 ; transform: translate3d(15%, -55%, 0) ; } 60%{ opacity: 0 ; transform: translate3d(-8%, -50%, 0) ; } } @keyframes period-line { 100% { stroke-dashoffset: 66 ; } } .active #security-cir { transform-box: fill-box ; transform-origin: center ; animation: security-cir calc( var(--duration-icon) / 1.5 ) ; } @keyframes security-cir { 0% { transform: scale(0) ; } 100% { transform: scale(1) ; } } .active #security-strok { stroke-dasharray: 96; animation: security-strok calc( var(--duration-icon) / 1.2 ) ; } @keyframes security-strok { 0% { stroke-dashoffset: 60 ; } 100% { stroke-dashoffset: 230 ; } } .active #settings-anm { transform-box: fill-box ; transform-origin: center ; animation: settings-anm calc( var(--duration-icon) / 1.5 ) ; } @keyframes settings-anm { 0% { transform: rotate(-60deg); } 50% { transform: rotate(60deg); } }
JavaScript
const buttons = document.querySelectorAll(".menu__item"); let activeButton = document.querySelector(".menu__item.active"); buttons.forEach(item => { const text = item.querySelector(".menu__text"); const lineWidth = text.offsetWidth + "px"; item.style.setProperty("--lineWidth", lineWidth); item.addEventListener("click", function() { if (this.classList.contains("active")) return; this.classList.add("active"); if (activeButton) { activeButton.classList.remove("active"); activeButton.querySelector(".menu__text").classList.remove("active"); } handleTransition(this, text); activeButton = this; }); }); function handleTransition(item, text) { item.addEventListener("transitionend", (e) => { if (e.propertyName != "flex-grow" || !item.classList.contains("active")) return; text.classList.add("active"); }); }
粒子
时间
文字
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号