mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-21 17:10:12 +01:00
This commit is contained in:
parent
c1b01b7fbd
commit
2c476118c3
1 changed files with 2 additions and 6 deletions
|
|
@ -1110,12 +1110,8 @@ data-type="navigation-root" data-path="/">
|
|||
target.classList.add("b3-list-item--focus");
|
||||
|
||||
if (isScroll) {
|
||||
const targetRect = target.getBoundingClientRect();
|
||||
const containerRect = this.element.getBoundingClientRect();
|
||||
|
||||
const relativeTop = targetRect.top - containerRect.top + this.element.scrollTop;
|
||||
|
||||
this.element.scrollTop = relativeTop - this.element.clientHeight / 2 - this.actionsElement.clientHeight;
|
||||
const elementRect = this.element.getBoundingClientRect();
|
||||
this.element.scrollTop = this.element.scrollTop + (target.getBoundingClientRect().top - (elementRect.top + elementRect.height / 2));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue