Toggle navigation
在线编辑器
在线代码
文本比较
jQuery下载
前端库
在线手册
登录/注册
下载代码
html
css
js
分享到微信朋友圈
X
html
FRONT END TRENDS 2021
Benefits of Frontend Technologies for Web
TypeScript
REACT
GraphQL
SVELTE
JEST
TypeScript
saves you time...
REACT
free and open-source library
GraphQL
a query language for APIs
SVELTE
cybernetically enhanced web apps
JEST
testing framework
css
* { margin: 0; padding: 0; box-sizing: border-box; font-size: 16px; } body { font-family: "ROBOTO", sans-serif; } a { text-decoration: none; } .nav, .slide { position: relative; z-index: 0; background: #1e1f26; text-align: center; display: flex; flex-direction: column; justify-content: center; align-items: center; height: 100vh; padding: 0 1vw; } .nav h1, .nav a, .slide h1, .slide a { font-size: 5vw; margin: 0 auto; padding-bottom: 0.5rem; letter-spacing: 0.4rem; color: #03dac6; transition: all 0.3s ease; } .nav h1:hover, .nav a:hover, .slide h1:hover, .slide a:hover { transform: translate3d(0, -10px, 22px); color: #ff0266; } .nav h3, .slide h3 { font-size: 2.7vw; letter-spacing: 0.2rem; font-family: "Josefin Sans", sans-serif; font-weight: 300; color: #faebd7; } .nav .nav-container, .slide .nav-container { display: flex; flex-direction: row; position: absolute; z-index: 2; bottom: 0; width: 100%; height: 70px; box-shadow: 0 0 20px rgba(0, 0, 0, 0.1); background: #fff; z-index: 10; } .nav .nav-container--top, .slide .nav-container--top { position: fixed; top: 0; } .nav .nav-tab, .slide .nav-tab { display: flex; justify-content: center; align-items: center; flex: 1; z-index: 3; color: #03dac6; letter-spacing: 0.1rem; font-size: 0.8rem; } .nav .nav-tab:hover, .slide .nav-tab:hover { color: #ff0266; transition: all 0.5s ease; } .nav .nav-tab-slider, .slide .nav-tab-slider { position: absolute; bottom: 0; width: 0; height: 6px; background: #03dac6; transition: left 0.3s ease; } @media (min-width: 800px) { .nav .nav-tab, .slide .nav-tab { font-size: 2vw; } .nav .nav h1, .nav .slide h1, .slide .nav h1, .slide .slide h1 { font-size: 3vw; } .nav .nav h3, .nav .slide h3, .slide .nav h3, .slide .slide h3 { font-size: 2vw; } } .background { position: absolute; height: 100vh; top: 0; bottom: 0; left: 0; right: 0; z-index: -1; }
JavaScript
var particles = Particles.init({ selector: ".background", color: ["#03dac6", "#ff0266", "#000000"], connectParticles: true, responsive: [ { breakpoint: 800, options: { color: "#ff0266", maxParticles: 43, connectParticles: false } } ] }); class NavigationPage { constructor() { this.currentId = null; this.currentTab = null; this.tabContainerHeight = 70; let self = this; $(".nav-tab").click(function () { self.onTabClick(event, $(this)); }); $(window).scroll(() => { this.onScroll(); }); $(window).resize(() => { this.onResize(); }); } onTabClick(event, element) { event.preventDefault(); let scrollTop = $(element.attr("href")).offset().top - this.tabContainerHeight + 1; $("html, body").animate({ scrollTop: scrollTop }, 600); } onScroll() { this.checkTabContainerPosition(); this.findCurrentTabSelector(); } onResize() { if (this.currentId) { this.setSliderCss(); } } checkTabContainerPosition() { let offset = $(".nav").offset().top + $(".nav").height() - this.tabContainerHeight; if ($(window).scrollTop() > offset) { $(".nav-container").addClass("nav-container--top"); } else { $(".nav-container").removeClass("nav-container--top"); } } findCurrentTabSelector(element) { let newCurrentId; let newCurrentTab; let self = this; $(".nav-tab").each(function () { let id = $(this).attr("href"); let offsetTop = $(id).offset().top - self.tabContainerHeight; let offsetBottom = $(id).offset().top + $(id).height() - self.tabContainerHeight; if ( $(window).scrollTop() > offsetTop && $(window).scrollTop() < offsetBottom ) { newCurrentId = id; newCurrentTab = $(this); } }); if (this.currentId != newCurrentId || this.currentId === null) { this.currentId = newCurrentId; this.currentTab = newCurrentTab; this.setSliderCss(); } } setSliderCss() { let width = 0; let left = 0; if (this.currentTab) { width = this.currentTab.css("width"); left = this.currentTab.offset().left; } $(".nav-tab-slider").css("width", width); $(".nav-tab-slider").css("left", left); } } new NavigationPage();
粒子
时间
文字
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号