diff --git a/src/components/d-cite.js b/src/components/d-cite.js index bf03a6e..48917af 100644 --- a/src/components/d-cite.js +++ b/src/components/d-cite.js @@ -19,7 +19,7 @@ const T = Template('d-cite', ` @@ -117,11 +121,14 @@ export class HoverBox extends T(HTMLElement) { show(position) { this.visible = true; this.style.display = 'block'; + // 10px extra offset from element + this.style.top = Math.round(position[1] + 10) + 'px'; } showAtNode(node) { + // https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/offsetTop const bbox = node.getBoundingClientRect(); - this.show([bbox.right, bbox.bottom]); + this.show([node.offsetLeft + bbox.width, node.offsetTop + bbox.height]); } hide() {