fix: 目录弹窗直接定位到当前章节,去掉滚动动画

This commit is contained in:
李策 2026-03-26 18:01:20 +08:00
parent a51fd5045f
commit 76f39363a0

View File

@ -576,13 +576,13 @@
}); });
tocList.innerHTML = html; tocList.innerHTML = html;
// 自动滚动到当前章节 // 自动定位到当前章节(无动画)
setTimeout(() => { setTimeout(() => {
const currentItem = tocList.querySelector('.current'); const currentItem = tocList.querySelector('.current');
if (currentItem) { if (currentItem) {
currentItem.scrollIntoView({ behavior: 'smooth', block: 'center' }); currentItem.scrollIntoView({ block: 'center' });
} }
}, 100); }, 50);
} }
// 更新移动端目录高亮 // 更新移动端目录高亮