741 lines
23 KiB
HTML
741 lines
23 KiB
HTML
<!DOCTYPE html>
|
||
<html lang="zh-CN">
|
||
<head>
|
||
<meta charset="UTF-8">
|
||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||
<title>导航主页</title>
|
||
<style>
|
||
:root {
|
||
--bg-color: #f7f9fb;
|
||
--card-bg: #ffffff;
|
||
--primary-color: #3b82f6;
|
||
--text-main: #1e293b;
|
||
--text-sub: #64748b;
|
||
--border-color: #e2e8f0;
|
||
--radius-main: 12px;
|
||
--shadow-card: 0 4px 12px rgba(0, 0, 0, 0.03), 0 1px 3px rgba(0, 0, 0, 0.02);
|
||
--shadow-hover: 0 10px 20px rgba(0, 0, 0, 0.06), 0 4px 6px rgba(0, 0, 0, 0.03);
|
||
|
||
--sidebar-width: 240px;
|
||
--top-nav-height: 60px;
|
||
}
|
||
|
||
* {
|
||
box-sizing: border-box;
|
||
margin: 0;
|
||
padding: 0;
|
||
}
|
||
|
||
/* 1. 锁死大窗口,禁止全局滚动 */
|
||
html, body {
|
||
width: 100vw;
|
||
height: 100vh;
|
||
overflow: hidden;
|
||
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
|
||
background-color: var(--bg-color);
|
||
color: var(--text-main);
|
||
}
|
||
|
||
/* 通用卡片容器 */
|
||
.card-box {
|
||
background-color: var(--card-bg);
|
||
border: 1px solid var(--border-color);
|
||
border-radius: var(--radius-main);
|
||
box-shadow: var(--shadow-card);
|
||
}
|
||
|
||
/* 2. 顶部直角导航栏 */
|
||
.top-header-bar {
|
||
position: fixed;
|
||
top: 0;
|
||
left: 0;
|
||
width: 100%;
|
||
height: var(--top-nav-height);
|
||
background-color: var(--card-bg);
|
||
border-bottom: 1px solid var(--border-color);
|
||
border-radius: 0 !important;
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: space-between;
|
||
padding: 0 24px;
|
||
z-index: 200;
|
||
}
|
||
|
||
.site-logo {
|
||
display: flex;
|
||
align-items: center;
|
||
gap: 10px;
|
||
font-weight: 800;
|
||
font-size: 18px;
|
||
color: #0f172a;
|
||
text-decoration: none;
|
||
width: 180px;
|
||
flex-shrink: 0;
|
||
}
|
||
|
||
.logo-icon {
|
||
width: 32px;
|
||
height: 32px;
|
||
background-color: #000;
|
||
border-radius: 50%;
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
color: #fff;
|
||
font-size: 16px;
|
||
font-weight: bold;
|
||
}
|
||
|
||
.ticker-wrapper {
|
||
flex: 1;
|
||
max-width: 550px;
|
||
height: 36px;
|
||
overflow: hidden;
|
||
position: relative;
|
||
margin: 0 20px;
|
||
display: flex;
|
||
align-items: center;
|
||
mask-image: linear-gradient(to right, transparent, black 10%, black 90%, transparent);
|
||
-webkit-mask-image: linear-gradient(to right, transparent, black 10%, black 90%, transparent);
|
||
}
|
||
|
||
.ticker-content {
|
||
display: flex;
|
||
gap: 40px;
|
||
white-space: nowrap;
|
||
animation: ticker 18s linear infinite;
|
||
}
|
||
|
||
.ticker-wrapper:hover .ticker-content {
|
||
animation-play-state: paused;
|
||
}
|
||
|
||
.ticker-item {
|
||
font-size: 13.5px;
|
||
color: var(--text-sub);
|
||
text-decoration: none;
|
||
display: flex;
|
||
align-items: center;
|
||
gap: 6px;
|
||
}
|
||
|
||
.ticker-tag {
|
||
background-color: #eff6ff;
|
||
color: var(--primary-color);
|
||
font-size: 11px;
|
||
padding: 2px 6px;
|
||
border-radius: 4px;
|
||
font-weight: 600;
|
||
}
|
||
|
||
@keyframes ticker {
|
||
0% { transform: translateX(0); }
|
||
100% { transform: translateX(-50%); }
|
||
}
|
||
|
||
.top-actions {
|
||
display: flex;
|
||
align-items: center;
|
||
gap: 12px;
|
||
flex-shrink: 0;
|
||
}
|
||
|
||
.action-btn {
|
||
background: transparent;
|
||
border: none;
|
||
cursor: pointer;
|
||
color: #475569;
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
padding: 6px;
|
||
border-radius: 50%;
|
||
transition: all 0.2s;
|
||
}
|
||
|
||
.action-btn:hover {
|
||
background-color: #f1f5f9;
|
||
color: var(--primary-color);
|
||
}
|
||
|
||
.action-btn svg {
|
||
width: 19px;
|
||
height: 19px;
|
||
stroke-width: 2;
|
||
stroke: currentColor;
|
||
fill: none;
|
||
stroke-linecap: round;
|
||
stroke-linejoin: round;
|
||
}
|
||
|
||
/* ---------------- 搜索框:全局固定且全屏水平居中 ---------------- */
|
||
.search-row {
|
||
position: fixed;
|
||
top: 76px;
|
||
left: 50%;
|
||
transform: translateX(-50%);
|
||
z-index: 100;
|
||
width: 480px;
|
||
height: 44px;
|
||
pointer-events: auto;
|
||
}
|
||
|
||
.search-bar {
|
||
display: flex;
|
||
align-items: center;
|
||
gap: 10px;
|
||
height: 100%;
|
||
width: 100%;
|
||
padding: 0 12px;
|
||
}
|
||
|
||
.engine-btn {
|
||
background: transparent;
|
||
border: none;
|
||
color: var(--text-sub);
|
||
cursor: pointer;
|
||
width: 28px;
|
||
height: 28px;
|
||
border-radius: 6px;
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
transition: all 0.2s;
|
||
}
|
||
|
||
.engine-btn:hover {
|
||
background-color: #f1f5f9;
|
||
color: var(--primary-color);
|
||
}
|
||
|
||
.engine-btn svg {
|
||
width: 16px;
|
||
height: 16px;
|
||
stroke-width: 2;
|
||
stroke: currentColor;
|
||
fill: none;
|
||
stroke-linecap: round;
|
||
stroke-linejoin: round;
|
||
}
|
||
|
||
.search-input {
|
||
width: 100%;
|
||
height: 36px;
|
||
font-size: 13.5px;
|
||
border: none;
|
||
background: transparent;
|
||
outline: none;
|
||
color: var(--text-main);
|
||
}
|
||
|
||
/* ---------------- 3. 双列核心网格 ---------------- */
|
||
.layout-grid {
|
||
margin-top: var(--top-nav-height);
|
||
height: calc(100vh - var(--top-nav-height));
|
||
padding: 36px 24px 0 20px;
|
||
display: grid;
|
||
grid-template-columns: var(--sidebar-width) 1fr;
|
||
gap: 20px;
|
||
align-items: start;
|
||
}
|
||
|
||
.left-column {
|
||
display: flex;
|
||
flex-direction: column;
|
||
gap: 16px;
|
||
flex-shrink: 0;
|
||
margin-top: 68px;
|
||
}
|
||
|
||
.right-column {
|
||
display: flex;
|
||
flex-direction: column;
|
||
gap: 16px;
|
||
height: 100%;
|
||
overflow: hidden;
|
||
padding-top: 52px;
|
||
}
|
||
|
||
.user-card {
|
||
height: 52px;
|
||
padding: 0 12px;
|
||
display: flex;
|
||
align-items: center;
|
||
gap: 12px;
|
||
}
|
||
|
||
.avatar {
|
||
width: 34px;
|
||
height: 34px;
|
||
border-radius: 8px;
|
||
background-color: #eff6ff;
|
||
color: var(--primary-color);
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
font-weight: 700;
|
||
font-size: 15px;
|
||
}
|
||
|
||
.user-name {
|
||
font-size: 13.5px;
|
||
font-weight: 600;
|
||
color: var(--text-main);
|
||
line-height: 1.2;
|
||
}
|
||
|
||
.user-desc {
|
||
font-size: 11.5px;
|
||
color: var(--text-sub);
|
||
margin-top: 2px;
|
||
}
|
||
|
||
.nav-card {
|
||
padding: 8px;
|
||
height: auto;
|
||
}
|
||
|
||
.nav-group {
|
||
list-style: none;
|
||
}
|
||
|
||
.nav-item-wrapper {
|
||
margin-bottom: 4px;
|
||
}
|
||
|
||
.nav-link {
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: space-between;
|
||
padding: 9px 12px;
|
||
color: var(--text-sub);
|
||
text-decoration: none;
|
||
border-radius: 8px;
|
||
font-size: 13.5px;
|
||
font-weight: 500;
|
||
cursor: pointer;
|
||
transition: all 0.2s;
|
||
}
|
||
|
||
.nav-link:hover, .nav-link.active {
|
||
background-color: #eff6ff;
|
||
color: var(--primary-color);
|
||
}
|
||
|
||
.arrow-icon {
|
||
font-size: 13px;
|
||
transition: transform 0.3s;
|
||
color: #94a3b8;
|
||
font-family: monospace;
|
||
font-weight: bold;
|
||
}
|
||
|
||
.nav-item-wrapper.open > .nav-link .arrow-icon {
|
||
transform: rotate(90deg);
|
||
}
|
||
|
||
.sub-menu {
|
||
list-style: none;
|
||
padding-left: 12px;
|
||
max-height: 0;
|
||
overflow: hidden;
|
||
transition: max-height 0.3s cubic-bezier(0, 1, 0, 1);
|
||
}
|
||
|
||
.nav-item-wrapper.open .sub-menu {
|
||
max-height: 500px;
|
||
transition: max-height 0.3s ease-in-out;
|
||
}
|
||
|
||
.sub-menu .nav-link {
|
||
padding: 7px 12.5px;
|
||
font-size: 12.5px;
|
||
}
|
||
|
||
.submit-card {
|
||
padding: 6px;
|
||
}
|
||
|
||
.submit-btn {
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
padding: 9px 12px;
|
||
color: var(--text-sub);
|
||
text-decoration: none;
|
||
border-radius: 8px;
|
||
font-size: 13.5px;
|
||
font-weight: 500;
|
||
}
|
||
|
||
.submit-btn:hover {
|
||
background-color: #eff6ff;
|
||
color: var(--primary-color);
|
||
}
|
||
|
||
/* 4. 右侧独立滚动区域 */
|
||
.main-content {
|
||
flex: 1;
|
||
overflow-y: auto;
|
||
padding-right: 4px;
|
||
padding-top: 16px;
|
||
padding-bottom: 40px;
|
||
|
||
-webkit-mask-image: linear-gradient(to bottom, transparent 0px, black 22px, black 100%);
|
||
mask-image: linear-gradient(to bottom, transparent 0px, black 22px, black 100%);
|
||
|
||
-ms-overflow-style: none;
|
||
scrollbar-width: none;
|
||
}
|
||
|
||
.main-content::-webkit-scrollbar {
|
||
display: none !important;
|
||
width: 0 !important;
|
||
}
|
||
|
||
.section-group {
|
||
margin-bottom: 24px;
|
||
}
|
||
|
||
.section-title {
|
||
font-size: 15px;
|
||
font-weight: 600;
|
||
color: var(--text-main);
|
||
display: flex;
|
||
align-items: center;
|
||
line-height: 1;
|
||
margin-bottom: 16px;
|
||
padding-top: 2px;
|
||
}
|
||
|
||
.section-title::before {
|
||
content: "";
|
||
display: inline-block;
|
||
width: 4px;
|
||
height: 15px;
|
||
background-color: var(--primary-color);
|
||
margin-right: 8px;
|
||
border-radius: 2px;
|
||
}
|
||
|
||
.grid {
|
||
display: grid;
|
||
grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
|
||
gap: 16px;
|
||
}
|
||
|
||
.card {
|
||
background-color: var(--card-bg);
|
||
border: 1px solid var(--border-color);
|
||
border-radius: 10px;
|
||
padding: 12px 14px;
|
||
display: flex;
|
||
align-items: center;
|
||
text-decoration: none;
|
||
color: inherit;
|
||
box-shadow: var(--shadow-card);
|
||
transition: transform 0.2s, box-shadow 0.2s;
|
||
}
|
||
|
||
.card:hover {
|
||
transform: translateY(-2px);
|
||
box-shadow: var(--shadow-hover);
|
||
}
|
||
|
||
.card-icon {
|
||
width: 36px;
|
||
height: 36px;
|
||
border-radius: 8px;
|
||
background-color: #f1f5f9;
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
font-weight: 600;
|
||
color: var(--primary-color);
|
||
margin-right: 12px;
|
||
flex-shrink: 0;
|
||
}
|
||
|
||
.card-title {
|
||
font-size: 14px;
|
||
font-weight: 600;
|
||
white-space: nowrap;
|
||
overflow: hidden;
|
||
text-overflow: ellipsis;
|
||
}
|
||
|
||
.card-desc {
|
||
font-size: 12px;
|
||
color: var(--text-sub);
|
||
margin-top: 2px;
|
||
white-space: nowrap;
|
||
overflow: hidden;
|
||
text-overflow: ellipsis;
|
||
}
|
||
|
||
.back-to-top {
|
||
position: fixed;
|
||
bottom: 30px;
|
||
right: 30px;
|
||
width: 40px;
|
||
height: 40px;
|
||
background-color: #e2e8f0;
|
||
border-radius: 50%;
|
||
color: #1e293b;
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
cursor: pointer;
|
||
box-shadow: var(--shadow-card);
|
||
transition: all 0.2s ease;
|
||
text-decoration: none;
|
||
z-index: 90;
|
||
}
|
||
|
||
.back-to-top:hover {
|
||
background-color: #cbd5e1;
|
||
transform: translateY(-2px);
|
||
}
|
||
|
||
.back-to-top svg {
|
||
width: 18px;
|
||
height: 18px;
|
||
stroke: currentColor;
|
||
stroke-width: 2.5;
|
||
fill: none;
|
||
stroke-linecap: round;
|
||
stroke-linejoin: round;
|
||
}
|
||
</style>
|
||
</head>
|
||
<body>
|
||
|
||
<!-- 顶栏 -->
|
||
<header class="top-header-bar">
|
||
<a href="#" class="site-logo">
|
||
<div class="logo-icon">S</div>
|
||
<span>SUXING</span>
|
||
</a>
|
||
|
||
<div class="ticker-wrapper">
|
||
<div class="ticker-content">
|
||
<a href="#" class="ticker-item"><span class="ticker-tag">公告</span> 欢迎使用最新版个人导航站!</a>
|
||
<a href="#" class="ticker-item"><span class="ticker-tag">更新</span> WordPress 主题升级至 v3.2 版本</a>
|
||
<a href="#" class="ticker-item"><span class="ticker-tag">推荐</span> 常用前端工具箱已更新资源</a>
|
||
<a href="#" class="ticker-item"><span class="ticker-tag">公告</span> 欢迎使用最新版个人导航站!</a>
|
||
<a href="#" class="ticker-item"><span class="ticker-tag">更新</span> WordPress 主题升级至 v3.2 版本</a>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="top-actions">
|
||
<button class="action-btn" title="暗黑模式">
|
||
<svg viewBox="0 0 24 24"><path d="M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"></path></svg>
|
||
</button>
|
||
<button class="action-btn" title="快捷方式">
|
||
<svg viewBox="0 0 24 24"><polygon points="13 2 3 14 12 14 11 22 21 10 12 10 13 2"></polygon></svg>
|
||
</button>
|
||
<button class="action-btn" title="全局搜索">
|
||
<svg viewBox="0 0 24 24"><circle cx="11" cy="11" r="8"></circle><line x1="21" y1="21" x2="16.65" y2="16.65"></line></svg>
|
||
</button>
|
||
</div>
|
||
</header>
|
||
|
||
<!-- 搜索框独立置于全屏水平居中位置 -->
|
||
<div class="search-row">
|
||
<div class="search-bar card-box">
|
||
<button class="engine-btn" title="切换搜索引擎">
|
||
<svg viewBox="0 0 24 24"><circle cx="11" cy="11" r="8"></circle><line x1="21" y1="21" x2="16.65" y2="16.65"></line></svg>
|
||
</button>
|
||
<input type="text" class="search-input" placeholder="输入关键字搜索全网资源...">
|
||
</div>
|
||
</div>
|
||
|
||
<!-- 主布局网格 -->
|
||
<div class="layout-grid">
|
||
|
||
<!-- 左侧固定边栏 -->
|
||
<div class="left-column">
|
||
<div class="user-card card-box">
|
||
<div class="avatar">S</div>
|
||
<div>
|
||
<div class="user-name">Suxing Admin</div>
|
||
<div class="user-desc">个人导航站</div>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="nav-card card-box">
|
||
<ul class="nav-group">
|
||
<li class="nav-item-wrapper">
|
||
<a href="#common" class="nav-link active">
|
||
<span>常用推荐</span>
|
||
</a>
|
||
</li>
|
||
<li class="nav-item-wrapper">
|
||
<div class="nav-link has-sub">
|
||
<span>素材资源</span>
|
||
<span class="arrow-icon">›</span>
|
||
</div>
|
||
<ul class="sub-menu">
|
||
<li><a href="#design" class="nav-link"><span>UI 设计资源</span></a></li>
|
||
<li><a href="#icon" class="nav-link"><span>矢量图标</span></a></li>
|
||
<li><a href="#photo" class="nav-link"><span>免费壁纸</span></a></li>
|
||
</ul>
|
||
</li>
|
||
<li class="nav-item-wrapper">
|
||
<div class="nav-link has-sub">
|
||
<span>开发工具</span>
|
||
<span class="arrow-icon">›</span>
|
||
</div>
|
||
<ul class="sub-menu">
|
||
<li><a href="#dev" class="nav-link"><span>前端调试工具</span></a></li>
|
||
<li><a href="#code" class="nav-link"><span>在线编辑器</span></a></li>
|
||
</ul>
|
||
</li>
|
||
</ul>
|
||
</div>
|
||
|
||
<div class="submit-card card-box">
|
||
<a href="#submit" class="submit-btn">提交网站</a>
|
||
</div>
|
||
</div>
|
||
|
||
<!-- 右侧区域 -->
|
||
<div class="right-column">
|
||
<!-- 右侧独立滚动内容 -->
|
||
<main class="main-content" id="scrollContainer">
|
||
<div id="common" class="section-group">
|
||
<div class="section-title">常用推荐</div>
|
||
<div class="grid">
|
||
<a href="#" class="card">
|
||
<div class="card-icon">G</div>
|
||
<div>
|
||
<div class="card-title">GitHub</div>
|
||
<div class="card-desc">代码托管与开源社区</div>
|
||
</div>
|
||
</a>
|
||
<a href="#" class="card">
|
||
<div class="card-icon">Z</div>
|
||
<div>
|
||
<div class="card-title">知乎</div>
|
||
<div class="card-desc">深度内容问答社区</div>
|
||
</div>
|
||
</a>
|
||
<a href="#" class="card">
|
||
<div class="card-icon">B</div>
|
||
<div>
|
||
<div class="card-title">哔哩哔哩</div>
|
||
<div class="card-desc">弹幕视频分享网站</div>
|
||
</div>
|
||
</a>
|
||
<a href="#" class="card">
|
||
<div class="card-icon">V</div>
|
||
<div>
|
||
<div class="card-title">V2EX</div>
|
||
<div class="card-desc">创意工作者讨论社区</div>
|
||
</div>
|
||
</a>
|
||
</div>
|
||
</div>
|
||
|
||
<div id="dev" class="section-group">
|
||
<div class="section-title">前端调试工具 (开发工具)</div>
|
||
<div class="grid">
|
||
<a href="#" class="card">
|
||
<div class="card-icon">S</div>
|
||
<div>
|
||
<div class="card-title">Stack Overflow</div>
|
||
<div class="card-desc">程序员技术问答</div>
|
||
</div>
|
||
</a>
|
||
<a href="#" class="card">
|
||
<div class="card-icon">J</div>
|
||
<div>
|
||
<div class="card-title">掘金</div>
|
||
<div class="card-desc">开发者技术社区</div>
|
||
</div>
|
||
</a>
|
||
</div>
|
||
</div>
|
||
|
||
<div id="code" class="section-group">
|
||
<div class="section-title">在线编辑器</div>
|
||
<div class="grid">
|
||
<a href="#" class="card">
|
||
<div class="card-icon">C</div>
|
||
<div>
|
||
<div class="card-title">CodePen</div>
|
||
<div class="card-desc">前端在线代码演练场</div>
|
||
</div>
|
||
</a>
|
||
</div>
|
||
</div>
|
||
|
||
<div id="design" class="section-group">
|
||
<div class="section-title">UI 设计资源</div>
|
||
<div class="grid">
|
||
<a href="#" class="card">
|
||
<div class="card-icon">D</div>
|
||
<div>
|
||
<div class="card-title">Dribbble</div>
|
||
<div class="card-desc">全球设计作品分享社区</div>
|
||
</div>
|
||
</a>
|
||
</div>
|
||
</div>
|
||
</main>
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<!-- 回到顶部按钮 -->
|
||
<a href="javascript:void(0)" class="back-to-top" id="backToTopBtn" title="回到顶部">
|
||
<svg viewBox="0 0 24 24">
|
||
<line x1="5" y1="4" x2="19" y2="4"></line>
|
||
<path d="M12 20V8M6 14l6-6 6 6"></path>
|
||
</svg>
|
||
</a>
|
||
|
||
<script>
|
||
document.querySelectorAll('.has-sub').forEach(trigger => {
|
||
trigger.addEventListener('click', () => {
|
||
trigger.closest('.nav-item-wrapper').classList.toggle('open');
|
||
});
|
||
});
|
||
|
||
const scrollContainer = document.getElementById('scrollContainer');
|
||
const backToTopBtn = document.getElementById('backToTopBtn');
|
||
|
||
backToTopBtn.addEventListener('click', () => {
|
||
scrollContainer.scrollTo({
|
||
top: 0,
|
||
behavior: 'smooth'
|
||
});
|
||
});
|
||
|
||
document.querySelectorAll('a.nav-link[href^="#"]').forEach(link => {
|
||
link.addEventListener('click', function(e) {
|
||
const targetId = this.getAttribute('href');
|
||
if (targetId === '#') return;
|
||
|
||
const targetElement = document.querySelector(targetId);
|
||
if (targetElement) {
|
||
e.preventDefault();
|
||
|
||
const containerTop = scrollContainer.getBoundingClientRect().top;
|
||
const elementTop = targetElement.getBoundingClientRect().top;
|
||
const currentScroll = scrollContainer.scrollTop;
|
||
const offsetPosition = currentScroll + (elementTop - containerTop) - 24;
|
||
|
||
scrollContainer.scrollTo({
|
||
top: offsetPosition,
|
||
behavior: 'smooth'
|
||
});
|
||
|
||
document.querySelectorAll('.nav-link').forEach(el => el.classList.remove('active'));
|
||
this.classList.add('active');
|
||
}
|
||
});
|
||
});
|
||
</script>
|
||
</body>
|
||
</html> |