1
0
mirror of https://github.com/amir20/dozzle.git synced 2026-01-03 11:35:00 +01:00

fix: uses getBoundingClientRect

This commit is contained in:
Amir Raminfar
2023-04-27 11:49:46 -07:00
parent e6efe6ff59
commit 1f85f046cf

View File

@@ -18,9 +18,10 @@ let trigger: HTMLElement | null = $ref(null);
function onMouseEnter(e: MouseEvent) {
show.value = true;
if (e.target && content) {
const x = e.target.offsetLeft + e.target.offsetWidth + 10;
const y = e.target.offsetTop;
if (e.target && content && e.target instanceof Element) {
const box = e.target.getBoundingClientRect();
const x = box.left + box.width + 10;
const y = box.top;
content.style.left = `${x}px`;
content.style.top = `${y}px`;