mirror of
https://github.com/alrayyes/wiki.git
synced 2025-05-29 02:19:01 +00:00
feat: use floating-ui for better popover positioning
This commit is contained in:
parent
c1b8fe1221
commit
ffe22689eb
3 changed files with 16 additions and 7 deletions
assets/js
|
@ -46,7 +46,18 @@ function initPopover(baseURL, useContextualBacklinks, renderLatex) {
|
|||
throwOnError: false
|
||||
})
|
||||
}
|
||||
|
||||
li.addEventListener("mouseover", () => {
|
||||
// fix tooltip positioning
|
||||
window.FloatingUIDOM.computePosition(li, el, {
|
||||
middleware: [window.FloatingUIDOM.offset(15), window.FloatingUIDOM.inline(), window.FloatingUIDOM.shift()],
|
||||
}).then(({ x, y }) => {
|
||||
Object.assign(el.style, {
|
||||
left: `${x}px`,
|
||||
top: `${y}px`,
|
||||
})
|
||||
})
|
||||
|
||||
el.classList.add("visible")
|
||||
})
|
||||
li.addEventListener("mouseout", () => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue