mirror of
https://github.com/twbs/bootstrap.git
synced 2025-09-25 21:09:06 +02:00
Use container instead of parent for tooltip/popover auto-placement calcs
Fixes #14561. Big thanks to @wickstargazer. [skip validator]
This commit is contained in:
@@ -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
|
||||
|
Reference in New Issue
Block a user