hexo-theme-linen 1.0.29 → 1.0.31
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -10,9 +10,19 @@
|
|
|
10
10
|
}
|
|
11
11
|
.nav-header.is-post {
|
|
12
12
|
position: fixed;
|
|
13
|
+
transform: translateY(0);
|
|
14
|
+
opacity: 1;
|
|
15
|
+
pointer-events: auto;
|
|
16
|
+
transition: transform 0.36s cubic-bezier(0.22, 1, 0.36, 1),
|
|
17
|
+
opacity 0.32s cubic-bezier(0.22, 1, 0.36, 1);
|
|
18
|
+
will-change: transform, opacity;
|
|
13
19
|
}
|
|
14
20
|
.nav-header.is-post.hide {
|
|
15
21
|
transform: translateY(-100%);
|
|
22
|
+
opacity: 0;
|
|
23
|
+
pointer-events: none;
|
|
24
|
+
transition: transform 0.26s cubic-bezier(0.32, 0, 0.67, 0),
|
|
25
|
+
opacity 0.22s ease;
|
|
16
26
|
}
|
|
17
27
|
.nav-header .header-inner .right .buttonSet .button.toc {
|
|
18
28
|
display: block;
|
|
@@ -89,11 +99,12 @@
|
|
|
89
99
|
.post-series {
|
|
90
100
|
display: none;
|
|
91
101
|
}
|
|
92
|
-
.nav-header
|
|
93
|
-
transform: translateY(0);
|
|
94
|
-
}
|
|
102
|
+
.nav-header,
|
|
95
103
|
.nav-header.hide {
|
|
96
|
-
transform: translateY(0);
|
|
104
|
+
transform: translateY(0) !important;
|
|
105
|
+
opacity: 1 !important;
|
|
106
|
+
pointer-events: auto !important;
|
|
107
|
+
transition: none !important;
|
|
97
108
|
}
|
|
98
109
|
}
|
|
99
110
|
.post-series {
|
|
@@ -239,8 +239,6 @@ body {
|
|
|
239
239
|
background-color: #fff;
|
|
240
240
|
// backdrop-filter: saturate(180%) blur(20px);
|
|
241
241
|
transform: translateY(0);
|
|
242
|
-
transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
|
|
243
|
-
will-change: transform;
|
|
244
242
|
z-index: 9;
|
|
245
243
|
position: relative;
|
|
246
244
|
top: 0;
|
|
@@ -369,7 +367,7 @@ body {
|
|
|
369
367
|
}
|
|
370
368
|
}
|
|
371
369
|
&.hide {
|
|
372
|
-
transform: translateY(
|
|
370
|
+
transform: translateY(0);
|
|
373
371
|
}
|
|
374
372
|
}
|
|
375
373
|
|
|
@@ -5,6 +5,7 @@ var isAnchoring = false;
|
|
|
5
5
|
var anchoringId = null;
|
|
6
6
|
var anchoringTimer = null;
|
|
7
7
|
function triggerAnchoring() {
|
|
8
|
+
if (window.innerWidth > 1280) return;
|
|
8
9
|
isAnchoring = true;
|
|
9
10
|
var header = document.querySelector(".nav-header");
|
|
10
11
|
if (header) {
|
|
@@ -13,6 +14,12 @@ function triggerAnchoring() {
|
|
|
13
14
|
clearTimeout(anchoringTimer);
|
|
14
15
|
anchoringTimer = setTimeout(function () {
|
|
15
16
|
isAnchoring = false;
|
|
17
|
+
if (window.scrollY <= 60) {
|
|
18
|
+
var header = document.querySelector(".nav-header");
|
|
19
|
+
if (header) {
|
|
20
|
+
header.classList.remove("hide");
|
|
21
|
+
}
|
|
22
|
+
}
|
|
16
23
|
}, 800);
|
|
17
24
|
}
|
|
18
25
|
|
|
@@ -275,20 +282,28 @@ function onScroll() {
|
|
|
275
282
|
typeof loadGitalk !== "undefined" && loadGitalk();
|
|
276
283
|
}
|
|
277
284
|
|
|
278
|
-
|
|
279
|
-
header.classList.
|
|
280
|
-
|
|
281
|
-
|
|
285
|
+
var isMobilePost =
|
|
286
|
+
window.innerWidth <= 1280 && header.classList.contains("is-post");
|
|
287
|
+
|
|
288
|
+
// PC 端没有 header 隐藏逻辑,确保无 hide 类
|
|
289
|
+
if (!isMobilePost && header.classList.contains("hide")) {
|
|
290
|
+
header.classList.remove("hide");
|
|
282
291
|
}
|
|
283
292
|
|
|
284
293
|
// 接近顶部时(<= 60px),强制展开并退出,消除 iOS/Mac 橡皮筋回弹误判与闪烁
|
|
285
294
|
if (currentScrollY <= 60) {
|
|
286
|
-
header.classList.remove("hide");
|
|
295
|
+
if (isMobilePost) header.classList.remove("hide");
|
|
287
296
|
if (backToTop) backToTop.classList.remove("visible");
|
|
288
297
|
previousScrollY = currentScrollY;
|
|
289
298
|
return;
|
|
290
299
|
}
|
|
291
300
|
|
|
301
|
+
if (isMobilePost && isAnchoring) {
|
|
302
|
+
header.classList.add("hide");
|
|
303
|
+
previousScrollY = currentScrollY;
|
|
304
|
+
return;
|
|
305
|
+
}
|
|
306
|
+
|
|
292
307
|
var scrollDelta = currentScrollY - previousScrollY;
|
|
293
308
|
// 滤除手指微小抖动
|
|
294
309
|
if (Math.abs(scrollDelta) < 8) {
|
|
@@ -297,7 +312,7 @@ function onScroll() {
|
|
|
297
312
|
|
|
298
313
|
if (scrollDelta < 0) {
|
|
299
314
|
// 向上滑动:即刻平滑展开导航栏
|
|
300
|
-
if (!document.querySelector(".pswp--open")) {
|
|
315
|
+
if (isMobilePost && !document.querySelector(".pswp--open")) {
|
|
301
316
|
header.classList.remove("hide");
|
|
302
317
|
}
|
|
303
318
|
if (backToTop && currentScrollY >= triggerHeight) {
|
|
@@ -306,7 +321,7 @@ function onScroll() {
|
|
|
306
321
|
} else {
|
|
307
322
|
// 向下滑动:离开顶部 60% 视口后平滑收起导航栏
|
|
308
323
|
if (backToTop) backToTop.classList.remove("visible");
|
|
309
|
-
if (currentScrollY > window.innerHeight * 0.6) {
|
|
324
|
+
if (isMobilePost && currentScrollY > window.innerHeight * 0.6) {
|
|
310
325
|
header.classList.add("hide");
|
|
311
326
|
}
|
|
312
327
|
}
|
|
@@ -337,6 +352,11 @@ window.addEventListener("resize", function () {
|
|
|
337
352
|
body.classList.add("resizing");
|
|
338
353
|
viewportWidth = window.innerWidth;
|
|
339
354
|
|
|
355
|
+
if (window.innerWidth > 1280) {
|
|
356
|
+
const header = document.querySelector(".nav-header");
|
|
357
|
+
if (header) header.classList.remove("hide");
|
|
358
|
+
}
|
|
359
|
+
|
|
340
360
|
clearTimeout(resizeTimer);
|
|
341
361
|
resizeTimer = setTimeout(function () {
|
|
342
362
|
body.classList.remove("resizing");
|
|
@@ -445,23 +465,46 @@ function handleClick(e) {
|
|
|
445
465
|
maskElement.classList.remove("visible");
|
|
446
466
|
setBodyScrollLocked(false);
|
|
447
467
|
}
|
|
448
|
-
|
|
468
|
+
const firstTocLink = tocElement
|
|
469
|
+
? tocElement.querySelector(".toc-item-link")
|
|
470
|
+
: null;
|
|
471
|
+
const isFirstToc =
|
|
472
|
+
target === firstTocLink ||
|
|
473
|
+
target.closest(".toc-item-link") === firstTocLink;
|
|
474
|
+
|
|
475
|
+
if (targetId === "to-page-top" || targetId === "page-top") {
|
|
449
476
|
window.scrollTo({
|
|
450
477
|
top: 0,
|
|
451
478
|
left: 0,
|
|
452
479
|
behavior: "instant",
|
|
453
480
|
});
|
|
481
|
+
isAnchoring = false;
|
|
482
|
+
clearTimeout(anchoringTimer);
|
|
483
|
+
var header = document.querySelector(".nav-header");
|
|
484
|
+
if (header) {
|
|
485
|
+
header.classList.remove("hide");
|
|
486
|
+
}
|
|
454
487
|
} else {
|
|
455
488
|
anchor &&
|
|
456
489
|
anchor.scrollIntoView({
|
|
457
490
|
behavior: "instant",
|
|
458
491
|
block: "start",
|
|
459
492
|
});
|
|
460
|
-
|
|
493
|
+
if (isFirstToc) {
|
|
494
|
+
isAnchoring = false;
|
|
495
|
+
clearTimeout(anchoringTimer);
|
|
496
|
+
var header = document.querySelector(".nav-header");
|
|
497
|
+
if (header) {
|
|
498
|
+
header.classList.remove("hide");
|
|
499
|
+
}
|
|
500
|
+
} else {
|
|
501
|
+
triggerAnchoring();
|
|
502
|
+
}
|
|
461
503
|
}
|
|
462
504
|
highlightAnchor(targetId);
|
|
463
505
|
if (
|
|
464
506
|
target.className?.includes("toc-item-link") &&
|
|
507
|
+
anchor &&
|
|
465
508
|
isElementInViewport(anchor)
|
|
466
509
|
) {
|
|
467
510
|
anchoringId = anchor.id;
|