Merge pull request #112 from fouksf/tooltips-fix
Fix bottom toolbar tooltips going out of the window. #106
This commit is contained in:
commit
ca0f006b4e
@ -185,6 +185,29 @@
|
|||||||
that.$element.trigger('shown.bs.' + that.type)
|
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') ?
|
$.support.transition && this.$tip.hasClass('fade') ?
|
||||||
$tip
|
$tip
|
||||||
.one($.support.transition.end, complete)
|
.one($.support.transition.end, complete)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user