awesome_tooltip 0.1.4 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 797a148e34dd9a929accdd686f18729013fb36c3790f9c9dcc0c8f5981c2ab31
|
4
|
+
data.tar.gz: d8616edfc05031cbc4637b6e8ab0f49b541d6b8eee1c4695feffc4910d4b7f2a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e4a25abd8a098d0c5112905b2ce9ff8f2bd8e5df7f5fc4a33e75304f65285ba813693510b016487e23da3b01c629b4e0bbf359f44ee3d2ea2efbd14a8bfd109b
|
7
|
+
data.tar.gz: ac15097e20390af82148bc360b79a84d9c9c83130fe79b85e8d6f49b058c4443e5d33873f6b4e41ea1721e39f07658d2c5a751abac32a97e24ec6de24b8f0787
|
@@ -39,12 +39,11 @@
|
|
39
39
|
var tooltipTriangle = tooltip.querySelector(".content-wrapper .triangle");
|
40
40
|
var elementRects = element.getClientRects()[0];
|
41
41
|
|
42
|
-
var leftEnoughSpace = tooltip.offsetWidth / 2 < elementRects.left;
|
42
|
+
var leftEnoughSpace = tooltip.offsetWidth / 2 + element.offsetWidth / 2 < elementRects.left;
|
43
43
|
var rightEnoughSpace = tooltip.offsetWidth / 2 < D.body.offsetWidth - elementRects.right;
|
44
|
-
var bottomEnoughSpace = tooltip.offsetHeight < W.
|
44
|
+
var bottomEnoughSpace = tooltip.offsetHeight < W.outerHeight - elementRects.bottom;
|
45
45
|
var topEnoughSpace = tooltip.offsetHeight < elementRects.top;
|
46
46
|
|
47
|
-
|
48
47
|
if(leftEnoughSpace && rightEnoughSpace && topEnoughSpace && bottomEnoughSpace) {
|
49
48
|
tooltip.style.cssText = "left: " + ((elementRects.width / 2) - (tooltip.getClientRects()[0].width / 2)) + "px;";
|
50
49
|
tooltipTriangle.style.cssText = "left: calc(50% - " + (tooltipTriangle.offsetWidth / 2) + "px);";
|
@@ -72,7 +71,7 @@
|
|
72
71
|
|
73
72
|
if(!leftEnoughSpace || !rightEnoughSpace) {
|
74
73
|
if(W.innerWidth / 2 > elementRects.right) {
|
75
|
-
tooltip.style.cssText = "left: " + (elementRects.right - element.offsetWidth) + "px;";
|
74
|
+
tooltip.style.cssText = "left: -" + (elementRects.right - element.offsetWidth) + "px;";
|
76
75
|
tooltipTriangle.style.cssText = "left: " + (elementRects.right - element.offsetWidth + tooltipTriangle.offsetWidth + tooltipTriangle.offsetWidth / 2) + "px;";
|
77
76
|
} else {
|
78
77
|
tooltip.style.cssText = "right: -" + (D.body.offsetWidth - elementRects.right) + "px;";
|
@@ -85,7 +84,7 @@
|
|
85
84
|
function display(element, tooltipTriangle, location) {
|
86
85
|
var tooltip = element.querySelector(".awesome-tooltip");
|
87
86
|
|
88
|
-
toggleLocation(
|
87
|
+
toggleLocation(tooltip, location);
|
89
88
|
tooltip.style.cssText = "left: " + ((element.getClientRects()[0].width / 2) - (tooltip.getClientRects()[0].width / 2)) + "px;";
|
90
89
|
tooltipTriangle.style.cssText = "left: calc(50% - " + (tooltipTriangle.offsetWidth / 2) + "px);";
|
91
90
|
}
|