aboutsummaryrefslogtreecommitdiff
path: root/js/tooltip.js
diff options
context:
space:
mode:
authorF A T <[email protected]>2015-04-27 11:28:54 -0700
committerF A T <[email protected]>2015-04-27 11:28:54 -0700
commitaa479892d5985939b005c7978023e05d124ae263 (patch)
tree73d0842dfaa6205c16bd76c47d115e2e21e9b24f /js/tooltip.js
parentcc8567d7846f72628ec6463f3667f95b55a10b5b (diff)
parent5921724d9c22098326bed005884477d3e8b6ec44 (diff)
downloadbootstrap-aa479892d5985939b005c7978023e05d124ae263.tar.xz
bootstrap-aa479892d5985939b005c7978023e05d124ae263.zip
Merge pull request #16152 from jarthod/tooltip-placement-viewport-fix
Tooltip/popover: Fix auto placement to use viewport
Diffstat (limited to 'js/tooltip.js')
-rw-r--r--js/tooltip.js11
1 files changed, 5 insertions, 6 deletions
diff --git a/js/tooltip.js b/js/tooltip.js
index 1f66413d8..f48dcfb70 100644
--- a/js/tooltip.js
+++ b/js/tooltip.js
@@ -193,13 +193,12 @@
if (autoPlace) {
var orgPlacement = placement
- var $container = this.options.container ? $(this.options.container) : this.$element.parent()
- var containerDim = this.getPosition($container)
+ var viewportDim = this.getPosition(this.$viewport)
- placement = placement == 'bottom' && pos.bottom + actualHeight > containerDim.bottom ? 'top' :
- placement == 'top' && pos.top - actualHeight < containerDim.top ? 'bottom' :
- placement == 'right' && pos.right + actualWidth > containerDim.width ? 'left' :
- placement == 'left' && pos.left - actualWidth < containerDim.left ? 'right' :
+ placement = placement == 'bottom' && pos.bottom + actualHeight > viewportDim.bottom ? 'top' :
+ placement == 'top' && pos.top - actualHeight < viewportDim.top ? 'bottom' :
+ placement == 'right' && pos.right + actualWidth > viewportDim.width ? 'left' :
+ placement == 'left' && pos.left - actualWidth < viewportDim.left ? 'right' :
placement
$tip