Skip to content

Commit

Permalink
fix: 修复仅高亮定位当前标题时,文章滚动到导航菜单在 viewport 中无法看到的章节,无法自动定位的问题;
Browse files Browse the repository at this point in the history
  • Loading branch information
yaohaixiao committed Apr 8, 2024
1 parent 05da7a9 commit 84a032a
Show file tree
Hide file tree
Showing 9 changed files with 9 additions and 13 deletions.
2 changes: 1 addition & 1 deletion docs/js/navigator.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/js/navigator.min.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/js/outline.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/js/outline.min.js.map

Large diffs are not rendered by default.

6 changes: 1 addition & 5 deletions navigator.js
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,6 @@ class Navigator extends Base {
const $main = this.$main
const $list = this.$list
const $anchor = $list.querySelector('.outline-navigator__anchor')
const animationCurrent = this.attr('animationCurrent')
const mainPaddingTop = parseInt(getStyle($main, 'padding-top'), 10)
const mainBorderTop = parseInt(getStyle($main, 'border-top-width'), 10)
const placeholderPaddingTop = parseInt(getStyle($list, 'padding-top'), 10)
Expand All @@ -301,10 +300,6 @@ class Navigator extends Base {
let offsetTop = 0
let top

if (!animationCurrent) {
return this
}

if (mainPaddingTop) {
offsetTop += mainPaddingTop
}
Expand Down Expand Up @@ -384,6 +379,7 @@ class Navigator extends Base {
}

later(() => {
console.log(!inBounding(this.$active, this.$main))
if (!inBounding(this.$active, this.$main)) {
placeholderOffsetTop = this._getPlaceholderOffset(this.active)
console.log('placeholderOffsetTop', placeholderOffsetTop)
Expand Down
2 changes: 1 addition & 1 deletion navigator.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion navigator.min.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion outline.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion outline.min.js.map

Large diffs are not rendered by default.

0 comments on commit 84a032a

Please sign in to comment.