Skip to content

Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.

Add fix to the tooltip library so tooltips never go out of the window. #106

foe956acf1fa77
diff --git a/libs/tooltip.js b/libs/tooltip.js
index f6c0a376c8..d62d5a4662 100644
--- a/libs/tooltip.js
+++ b/libs/tooltip.js
@@ -185,6 +185,29 @@
that.$element.trigger('shown.bs.' + that.type)
}
+ var deltas = {
+ "bottom": $tip[0].getBoundingClientRect().bottom - window.innerHeight,
+ "right": $tip[0].getBoundingClientRect().right - window.innerWidth,
+ "left": -$tip[0].getBoundingClientRect().left,
+ "top": -$tip[0].getBoundingClientRect().top
+ };
+ for(var direction in deltas) {
+ if (deltas[direction] > 0) {
+ var delta = deltas[direction];
+ if(direction === "right" || direction === "bottom") {
+ delta = -delta;
+ }
+ direction = direction === "top" || direction === "bottom" ? "top" : "left";
+ var currentPosition = parseInt($tip.css(direction), 10);
+ $tip.css(direction, currentPosition + delta);
+ if(direction === "left") {
+ $tip.children(".arrow").css(direction, parseInt($tip.children(".arrow").css(direction), 10) - delta);
+ } else {
+ $tip.children(".arrow").css(direction, 50 - $tip[0].getBoundingClientRect().height / delta + "%");
+ }
+ }
+ }
+
$.support.transition && this.$tip.hasClass('fade') ?
$tip
.one($.support.transition.end, complete)