v26110905 首页回位:锚点跳过浮层/吸顶元素

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
deploy
2026-11-09 14:34:41 +00:00
parent bda7bfd411
commit ea66012f3a

View File

@@ -297,7 +297,8 @@
let a = null, bd = 1e9;
sc.querySelectorAll('[id]').forEach(el => {
const r = el.getBoundingClientRect();
if (r.height < 60 || r.bottom <= top) return;
if (r.height < 60 || r.height > sc.clientHeight * 4 || r.bottom <= top) return;
for (let x = el; x && x !== sc; x = x.parentElement) { const ps = getComputedStyle(x).position; if (ps === 'fixed' || ps === 'absolute' || ps === 'sticky') return; } /* 浮层 / 吸顶不跟着滚,不能当锚点 */
const d = Math.abs(r.top - top);
if (d < bd) { bd = d; a = { id: el.id, off: r.top - top }; }
});