diff options
| author | Chris Rebert <[email protected]> | 2014-09-15 12:36:40 -0700 |
|---|---|---|
| committer | Chris Rebert <[email protected]> | 2014-09-24 20:46:49 -0700 |
| commit | 4d9890ea2e7e868221d0c2254c9dc86152304815 (patch) | |
| tree | 61bca50417688ca09741bf7969e51a8f89535aa0 /js/tooltip.js | |
| parent | 7ce682474843d10631b149b017cffa35eb9ee3c5 (diff) | |
| download | bootstrap-4d9890ea2e7e868221d0c2254c9dc86152304815.tar.xz bootstrap-4d9890ea2e7e868221d0c2254c9dc86152304815.zip | |
Use container instead of parent for tooltip/popover auto-placement calcs
Fixes #14561. Big thanks to @wickstargazer.
[skip validator]
Diffstat (limited to 'js/tooltip.js')
| -rw-r--r-- | js/tooltip.js | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/js/tooltip.js b/js/tooltip.js index d0da83a5a..55dedcef4 100644 --- a/js/tooltip.js +++ b/js/tooltip.js @@ -188,13 +188,13 @@ if (autoPlace) { var orgPlacement = placement - var $parent = this.$element.parent() - var parentDim = this.getPosition($parent) + var $container = this.options.container ? $(this.options.container) : this.$element.parent() + var containerDim = this.getPosition($container) - placement = placement == 'bottom' && pos.top + pos.height + actualHeight - parentDim.scroll > parentDim.height ? 'top' : - placement == 'top' && pos.top - parentDim.scroll - actualHeight < parentDim.top ? 'bottom' : - placement == 'right' && pos.right + actualWidth > parentDim.width ? 'left' : - placement == 'left' && pos.left - actualWidth < parentDim.left ? 'right' : + placement = placement == 'bottom' && pos.top + pos.height + actualHeight - containerDim.scroll > containerDim.height ? 'top' : + placement == 'top' && pos.top - containerDim.scroll - actualHeight < containerDim.top ? 'bottom' : + placement == 'right' && pos.right + actualWidth > containerDim.width ? 'left' : + placement == 'left' && pos.left - actualWidth < containerDim.left ? 'right' : placement $tip |
