Toggle navigation
在线编辑器
在线代码
文本比较
jQuery下载
前端库
在线手册
登录/注册
下载代码
html
css
js
分享到微信朋友圈
X
html
Home
Favorites
Settings
css
@import url("https://fonts.googleapis.com/css?family=Poppins:500,600&display=swap"); * { box-sizing: border-box; padding: 0; margin: 0; } body { font-family: "Poppins", sans-serif; background: linear-gradient(to bottom, hsl(250, 14%, 9%), hsl(250, 20%, 15%)); /* center the nav in the viewport */ min-height: 100vh; display: flex; justify-content: center; align-items: center; overflow: hidden; /* set a perspective for the nested nav */ perspective: 500px; } /* display the anchor links in three columns of equal width */ nav { display: grid; grid-template-columns: repeat(3, 100px); grid-column-gap: 4rem; padding: 2rem 3rem; justify-items: center; align-items: center; background: hsl(250, 16%, 26%); box-shadow: 0 0 15px hsla(250, 16%, 5%, 0.3); border-radius: 30px; color: hsl(250, 16%, 90%); /* translate the nav element backwards to offset the translation of the anchor links (otherwise the text would be fuzzy) */ transform: translateZ(-70px); transform-origin: 50% 100%; /* transition for the transform property the navigation is moved around the viewport with 3d transform */ transition-property: transform; transition-duration: 1.25s; transition-timing-function: cubic-bezier(0.175, 0.885, 0.32, 1.275); /* preserve3d to have the transform property on the anchor link retain the 3d space */ transform-style: preserve-3d; /* position relative to absolute position the graticulate */ position: relative; } /* display the nested icon and text element in a column */ nav a { display: flex; flex-direction: column; align-items: center; color: inherit; text-decoration: none; /* by default have the anchor links semitransparent */ opacity: 0.3; /* transition for the change in opacity and transform property */ transition-property: opacity, transform; transition-duration: 0.6s; transition-timing-function: cubic-bezier(0.55, 0.085, 0.68, 0.53); /* position relative for the pseudo element */ position: relative; } /* with a pseudo element include a circle centered in the link */ nav a:before { position: absolute; content: ""; width: 150px; height: 150px; border-radius: 50%; background: hsl(250, 16%, 90%); /* slightly offset the circle to have the shape closer to the icon than the text */ top: 40%; left: 50%; /* by default have the circle scaled out of sight ! do not set a transition to have the circle removed without the smooth change */ transform: translate(-50%, -50%) scale(0); opacity: 1; } nav a svg { display: block; } nav a span { font-size: 1rem; text-transform: uppercase; letter-spacing: 0.05rem; padding-top: 1rem; } /* absolute position the graticulate behind the navigation */ nav svg#graticulate { position: absolute; top: 50%; left: 50%; /* stretch the svg to have the element fake the background */ height: 150vh; width: auto; /* rotate the svg to give depth to the environment */ transform-origin: 50% 100%; transform: translate(-50%, -50%) rotateX(30deg); z-index: -5; } /* set the transform and opacity values for the different states of the navigation */ nav.home { transform: translateX(42px) translateZ(-70px) rotateX(2deg) rotateY(-3deg); } nav.home a:nth-of-type(1) { opacity: 1; transform: translateZ(70px); } nav.favorites { transform: translateZ(-70px) rotateX(1deg); } nav.favorites a:nth-of-type(2) { opacity: 1; transform: translateZ(70px); } nav.settings { transform: translateX(-42px) translateZ(-70px) rotateX(2deg) rotateY(3deg); } nav.settings a:nth-of-type(3) { opacity: 1; transform: translateZ(70px); } /* set up a transition for the circle above the anchor links included as the elements are selected */ nav.home a:nth-of-type(1):before, nav.favorites a:nth-of-type(2):before, nav.settings a:nth-of-type(3):before { opacity: 0; transform: translate(-50%, -50%) scale(1); transition-property: opacity, transform; transition-duration: 0.6s; transition-timing-function: cubic-bezier(0.55, 0.085, 0.68, 0.53); } /* add a shadow beneath the svg icons */ nav.home a:nth-of-type(1) svg { filter: drop-shadow(5px 2px 2px hsla(250, 16%, 5%, 0.2)); } nav.favorites a:nth-of-type(2) svg { filter: drop-shadow(0 5px 2px hsla(250, 16%, 5%, 0.2)); } nav.settings a:nth-of-type(3) svg { filter: drop-shadow(-5px 2px 2px hsla(250, 16%, 5%, 0.2)); }
JavaScript
// select all anchor link elements const links = document.querySelectorAll('a'); // when a click is registered on the link consider the text of the span element and use it for the class of the parent nav links.forEach(link => link.addEventListener('click', (e) => { link.parentNode.className = link.innerText.toLowerCase(); }));
粒子
时间
文字
hover
canvas
3d
游戏
音乐
火焰
水波
轮播图
鼠标跟随
动画
css
加载动画
导航
菜单
按钮
滑块
tab
弹出层
统计图
svg
×
Close
在线代码下载提示
开通在线代码永久免费下载,需支付20jQ币
开通后,在线代码模块中所有代码可终身免费下!
您已开通在线代码永久免费下载,关闭提示框后,点下载代码可直接下载!
您已经开通过在线代码永久免费下载
对不起,您的jQ币不足!可通过发布资源 或
直接充值获取jQ币
取消
开通下载
<!doctype html> <html> <head> <meta charset="utf-8"> <title>VR导航-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号