feat(site): add responsive mobile navigation drawer and header layout

This commit is contained in:
N0VAN0M4LY committed 2026-12-03 11:49:44 +08:00
1 parent 0ae38143d6
commit 008c11cc2c
6 files changed
+171 -13

No files matched your search

+2 -2
View File
@@ -7,7 +7,7 @@
<meta name="description" content="WTOffline 开发者手册:术语词典、整体架构与请求调用链、好坏代码对比与 AI 约束提示词、EXE 57 字节逐指令拆解、Native 6 文件完整接线、流量日志排错与 PR 规范。">
<link rel="icon" type="image/svg+xml" href="assets/icon.svg">
<link rel="stylesheet" href="site/tokens.css?v=0e5a4a4c">
<link rel="stylesheet" href="site/home.css?v=a4d73fdb">
<link rel="stylesheet" href="site/home.css?v=355a55fd">
</head>
<body data-lang="zh" data-page="dev-docs">
<div id="blink"></div>
@@ -1427,6 +1427,6 @@ cmake --build build/quirrel-cli --config Release --target sq</code></pre></div>
</footer>
</main>
<script src="site/home.js?v=7938c985"></script>
<script src="site/home.js?v=e267aee3"></script>
</body>
</html>
+2 -2
View File
@@ -10,7 +10,7 @@
<meta property="og:type" content="website">
<link rel="icon" type="image/svg+xml" href="assets/icon.svg">
<link rel="stylesheet" href="site/tokens.css?v=0e5a4a4c">
<link rel="stylesheet" href="site/home.css?v=a4d73fdb">
<link rel="stylesheet" href="site/home.css?v=355a55fd">
</head>
<body data-lang="zh">
<!-- Opening shutter removed by home.js once animation ends -->
@@ -399,6 +399,6 @@
</main>
<script src="site/home.js?v=7938c985"></script>
<script src="site/home.js?v=e267aee3"></script>
</body>
</html>
+2 -2
View File
@@ -7,7 +7,7 @@
<meta name="description" content="WTOffline 全 7 章添加式模组制作手册:原版解包查阅、mod.jsonc 清单、BLK/CSV 增量补丁、权重换算、衍生车闭环实战、自定义 3D 模型、GUI/EXE 补丁与服务端 JS/TS 脚本 API。">
<link rel="icon" type="image/svg+xml" href="assets/icon.svg">
<link rel="stylesheet" href="site/tokens.css?v=0e5a4a4c">
<link rel="stylesheet" href="site/home.css?v=a4d73fdb">
<link rel="stylesheet" href="site/home.css?v=355a55fd">
</head>
<body data-lang="zh" data-page="mod-docs">
<div id="blink"></div>
@@ -1916,6 +1916,6 @@ openUrl(&quot;http://{{LOCAL_ENDPOINT}}/mods/demo.my-mod/panel&quot;, false, fal
</footer>
</main>
<script src="site/home.js?v=7938c985"></script>
<script src="site/home.js?v=e267aee3"></script>
</body>
</html>
+2 -2
View File
@@ -7,7 +7,7 @@
<meta name="description" content="WTOffline 启动器与游戏版本适配包全版本下载页,包含安装版、便携包及 SHA-256 校验值。">
<link rel="icon" type="image/svg+xml" href="assets/icon.svg">
<link rel="stylesheet" href="site/tokens.css?v=0e5a4a4c">
<link rel="stylesheet" href="site/home.css?v=a4d73fdb">
<link rel="stylesheet" href="site/home.css?v=355a55fd">
</head>
<body data-lang="zh" data-page="releases">
<div id="blink"></div>
@@ -134,6 +134,6 @@
</footer>
</main>
<script src="site/home.js?v=7938c985"></script>
<script src="site/home.js?v=e267aee3"></script>
</body>
</html>
+103 -4
View File
@@ -250,6 +250,8 @@ body.leaving {
display: inline-flex;
align-items: center;
gap: 10px;
flex-shrink: 0;
white-space: nowrap;
font-family: var(--font-display);
font-weight: 700;
font-size: 16px;
@@ -263,6 +265,7 @@ body.leaving {
width: 28px;
height: 28px;
display: block;
flex-shrink: 0;
}
.brand-accent {
@@ -274,6 +277,7 @@ body.leaving {
display: flex;
align-items: center;
gap: 4px;
min-width: 0;
}
.nav-links a {
@@ -283,9 +287,19 @@ body.leaving {
text-decoration: none;
font-size: 13.5px;
font-weight: 500;
white-space: nowrap;
flex-shrink: 0;
transition: color 0.2s var(--ease), background 0.2s var(--ease);
}
.nav-menu-btn {
display: none;
}
.nav-drawer {
display: none;
}
.nav-links a:hover,
.nav-links a.active {
color: var(--text);
@@ -1723,8 +1737,93 @@ footer {
/* ---------------- Responsive ---------------- */
@media (max-width: 680px) {
.nav-links a.hide-sm { display: none; }
.grid { background-size: 44px 44px; }
.foot .right { margin-left: 0; }
@media (max-width: 880px) {
.nav {
gap: var(--s2);
padding: 11px clamp(14px, 4vw, 24px);
}
.nav-links a {
padding: 6px 8px;
font-size: 13px;
}
}
@media (max-width: 740px) {
.nav {
position: sticky;
top: 0;
padding: 10px 14px;
}
.nav-links {
gap: 6px;
}
.nav-links > a {
display: none;
}
.nav-menu-btn {
display: inline-flex;
}
.nav-drawer {
position: fixed;
top: 53px;
left: 0;
right: 0;
z-index: 49;
display: flex;
flex-direction: column;
gap: 4px;
padding: 10px 14px 14px;
background: color-mix(in srgb, var(--page) 94%, transparent);
-webkit-backdrop-filter: blur(20px) saturate(1.2);
backdrop-filter: blur(20px) saturate(1.2);
border-bottom: 1px solid var(--border-2);
box-shadow: var(--shadow-md);
opacity: 0;
transform: translateY(-8px);
pointer-events: none;
transition: opacity 0.22s var(--ease), transform 0.22s var(--ease);
}
.nav-drawer.open {
opacity: 1;
transform: translateY(0);
pointer-events: auto;
}
.nav-drawer a {
display: flex;
align-items: center;
justify-content: space-between;
min-height: 42px;
padding: 8px 12px;
border-radius: var(--r-sm);
color: var(--text-dim);
text-decoration: none;
font-size: 14.5px;
font-weight: 500;
border: 1px solid transparent;
transition: color 0.18s var(--ease), background 0.18s var(--ease), border-color 0.18s var(--ease);
}
.nav-drawer a:hover,
.nav-drawer a.active {
color: var(--text);
background: var(--surface);
border-color: var(--border);
}
.nav-drawer a.active {
color: var(--accent);
border-color: rgba(229, 57, 53, 0.35);
background: var(--accent-soft);
}
.grid {
background-size: 44px 44px;
}
.foot .right {
margin-left: 0;
}
.hero-wordmark {
height: clamp(84px, 22vw, 132px);
}
.doc-pager-btn {
width: 100%;
min-width: 0;
}
}
+60 -1
View File
@@ -235,13 +235,72 @@
});
})();
// ---- Sticky header border ----
// ---- Sticky header border & responsive mobile drawer ----
(function initStickyNav() {
var nav = document.querySelector('.nav');
if (!nav) return;
var update = function () { nav.classList.toggle('stuck', window.scrollY > 8); };
update();
window.addEventListener('scroll', update, { passive: true });
var navLinks = nav.querySelector('.nav-links');
if (!navLinks) return;
var linkNodes = Array.prototype.slice.call(navLinks.querySelectorAll(':scope > a'));
if (!linkNodes.length) return;
var MENU_SVG =
'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.9" stroke-linecap="round">' +
'<path d="M4 7h16M4 12h16M4 17h16"/></svg>';
var CLOSE_SVG =
'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.9" stroke-linecap="round">' +
'<path d="M6 6l12 12M18 6L6 18"/></svg>';
var menuBtn = document.createElement('button');
menuBtn.type = 'button';
menuBtn.className = 'ui-btn ui-iconbtn nav-menu-btn';
menuBtn.setAttribute('aria-label', 'Toggle navigation menu');
menuBtn.setAttribute('aria-expanded', 'false');
menuBtn.innerHTML = MENU_SVG;
navLinks.appendChild(menuBtn);
var drawer = document.createElement('nav');
drawer.className = 'nav-drawer';
drawer.setAttribute('aria-label', 'Mobile navigation');
linkNodes.forEach(function (orig) {
var clone = orig.cloneNode(true);
clone.classList.remove('hide-sm');
drawer.appendChild(clone);
});
nav.insertAdjacentElement('afterend', drawer);
function setOpen(open) {
drawer.classList.toggle('open', open);
menuBtn.setAttribute('aria-expanded', open ? 'true' : 'false');
menuBtn.innerHTML = open ? CLOSE_SVG : MENU_SVG;
}
menuBtn.addEventListener('click', function (e) {
e.stopPropagation();
setOpen(!drawer.classList.contains('open'));
});
drawer.addEventListener('click', function (e) {
if (e.target.closest('a')) setOpen(false);
});
document.addEventListener('click', function (e) {
if (drawer.classList.contains('open') && !e.target.closest('.nav') && !e.target.closest('.nav-drawer')) {
setOpen(false);
}
});
document.addEventListener('keydown', function (e) {
if (e.key === 'Escape' && drawer.classList.contains('open')) setOpen(false);
});
window.addEventListener('resize', function () {
if (window.innerWidth > 740 && drawer.classList.contains('open')) setOpen(false);
});
})();
// ---- Resolve extensionless routes cleanly when previewed via file:// ----