aboutsummaryrefslogtreecommitdiff
path: root/ext/fg/js/popup.js
diff options
context:
space:
mode:
authorAlex Yatskov <alex@foosoft.net>2016-04-24 11:04:24 -0700
committerAlex Yatskov <alex@foosoft.net>2016-04-24 11:04:24 -0700
commit709094455e77d8ceba199316631381fcad47ef5d (patch)
treeb4423fd57ce0731ee92fc78263cb5e8c288734a2 /ext/fg/js/popup.js
parent75d5d84811354cc6dc92c635fb77ad62b4c0aafe (diff)
Improvements
Diffstat (limited to 'ext/fg/js/popup.js')
-rw-r--r--ext/fg/js/popup.js11
1 files changed, 3 insertions, 8 deletions
diff --git a/ext/fg/js/popup.js b/ext/fg/js/popup.js
index 92ade784..16a62b1c 100644
--- a/ext/fg/js/popup.js
+++ b/ext/fg/js/popup.js
@@ -33,11 +33,10 @@ class Popup {
this.setContent(content);
}
- showNextTo(element, content) {
+ showNextTo(elementRect, content) {
this.inject();
- const elementRect = element.getBoundingClientRect();
- const popupRect = this.popup.getBoundingClientRect();
+ const popupRect = this.popup.getBoundingClientRect();
let posX = elementRect.left;
if (posX + popupRect.width >= window.innerWidth) {
@@ -49,11 +48,7 @@ class Popup {
posY = elementRect.top - popupRect.height - this.offset;
}
- this.popup.style.left = posX + 'px';
- this.popup.style.top = posY + 'px';
- this.popup.style.visibility = 'visible';
-
- this.setContent(content);
+ this.showAt({x: posX, y: posY}, content);
}
hide() {