diff --git a/web/navi.js b/web/navi.js index 3d4b091..440fd2d 100644 --- a/web/navi.js +++ b/web/navi.js @@ -629,6 +629,7 @@ let swipeEl = null; // 已绑定手势的 .minimal-home(元素重建时重绑) let swipeDocBound = false; // document 级监听只装一次 let swipeBusy = false, swipeAcc = 0, swipeAccAt = 0, swipeCoolUntil = 0, swipeEatClick = 0; + let swipeSelfClick = false; // 我们自己的切换 click 不能被自己的防误触拦掉 function swipeTabs() { return Array.from(document.querySelectorAll('.minimal-headings-row > .minimal-section-heading.headings')); @@ -687,7 +688,11 @@ frame.style.opacity = '0.28'; await later(90); } - tabs[j].click(); + // 关键:这是我们自己发起的切换 click —— 必须绕开"防误触"拦截, + // 否则会出现"手势收到了、手势条件也满足,但页面没切"的怪象(实测踩过)。 + swipeEatClick = 0; + swipeSelfClick = true; + try { tabs[j].click(); } finally { swipeSelfClick = false; } await later(70); if (fade) { frame.style.transition = 'opacity 150ms ease'; @@ -752,7 +757,8 @@ swipeAccAt = now; swipeAcc += evt.deltaX; if (Math.abs(swipeAcc) >= SWIPE.wheelShown && !swipeBusy && now >= swipeCoolUntil) { - const dir = swipeAcc < 0 ? 1 : -1; + // 方向语义实测:两指向左滑 → 浏览器给 deltaX > 0 → 应是"下一个分组" + const dir = swipeAcc > 0 ? 1 : -1; swipeAcc = 0; swipeSwitch(dir); } @@ -762,6 +768,7 @@ swipeDocBound = true; // 滑动后吞掉紧随的一次 click,避免误开卡片里的链接 document.addEventListener('click', (evt) => { + if (swipeSelfClick) return; // 放行我们自己的切换 click if (Date.now() < swipeEatClick) { swipeEatClick = 0; evt.preventDefault();