Skip to content

Commit

Permalink
fix: Toc trigger shrinks outside page when toggling off
Browse files Browse the repository at this point in the history
  • Loading branch information
hikerpig committed Jul 13, 2020
1 parent 36269a5 commit 4722d05
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions toc-bar.user.js
Original file line number Diff line number Diff line change
Expand Up @@ -542,6 +542,15 @@ a.toc-link {
} else {
this.element.classList.add(HIDDEN_CLASS)
this.logoSvg && this.logoSvg.classList.add(LOGO_HIDDEN_CLASS)

const right = parseInt(this.element.style.right)
if (right && right < 0) {
this.element.style.right = "0px"
const cachedPosition = POSITION_STORAGE.cache
if (!isEmpty(cachedPosition)) {
POSITION_STORAGE.set(null, {...cachedPosition, right: 0 })
}
}
}
this.visible = shouldShow
},
Expand Down

0 comments on commit 4722d05

Please sign in to comment.