add scroll to hint position
This commit is contained in:
parent
685164629d
commit
dcebe33628
1 changed files with 4 additions and 2 deletions
|
@ -10,12 +10,14 @@ export default class Hint {
|
||||||
|
|
||||||
let doc = target.ownerDocument
|
let doc = target.ownerDocument
|
||||||
let { top, left } = target.getBoundingClientRect();
|
let { top, left } = target.getBoundingClientRect();
|
||||||
|
let scrollX = window.scrollX;
|
||||||
|
let scrollY = window.scrollY;
|
||||||
|
|
||||||
this.element = doc.createElement('span');
|
this.element = doc.createElement('span');
|
||||||
this.element.className = 'vimvixen-hint';
|
this.element.className = 'vimvixen-hint';
|
||||||
this.element.textContent = tag;
|
this.element.textContent = tag;
|
||||||
this.element.style.top = top + 'px';
|
this.element.style.left = left + scrollX + 'px';
|
||||||
this.element.style.left = left + 'px';
|
this.element.style.top = top + scrollY + 'px';
|
||||||
|
|
||||||
this.show();
|
this.show();
|
||||||
doc.body.append(this.element);
|
doc.body.append(this.element);
|
||||||
|
|
Reference in a new issue