Replies: 1 comment
-
此问题已经在 #353 中修复。 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
我发现点击左侧目录,跳转的时候计算位置的时候没有乘以相应的放大倍率,导致滚动的位置不太准确
以下是我的解决方案:在src/components/container/toc.vue
1、乘以容器改变后的倍率
const pageContainer = document.querySelector(
${container} .umo-zoomable-container,
) as HTMLElement
const pageHeader = pageContainer?.querySelector(
'.umo-page-node-header',
) as HTMLElement
if (!nodeElement || !pageContainer || !pageHeader) {
return
}
pageContainer.scrollTo({
top: (nodeElement.offsetTop + pageHeader.offsetHeight)*容器改变后的倍率,
})
2、使用scrollIntoView(最简单)
nodeElement.scrollIntoView({
block: 'start',
})
Beta Was this translation helpful? Give feedback.
All reactions