Update tooltip.js positionTooltip
- update `positionTooltip` fn to apply the proper class to tooltips/popovers when using "auto" placement determination - now if a popover with "auto right" ends up being calculated to the left, the popover will receive the correct `left` class, and not `right`
This commit is contained in:
@@ -162,7 +162,8 @@ angular.module('ui.bootstrap.tooltip', ['ui.bootstrap.position', 'ui.bootstrap.s
|
||||
if (!positionTimeout) {
|
||||
positionTimeout = $timeout(function() {
|
||||
var placementClasses = $position.parsePlacement(ttScope.placement);
|
||||
var placement = placementClasses[1] === 'center' ? placementClasses[0] : placementClasses[0] + '-' + placementClasses[1];
|
||||
var ttPosition = $position.positionElements(element, tooltip, ttScope.placement, appendToBody, true);
|
||||
var placement = ttPosition.placement;
|
||||
|
||||
// need to add classes prior to placement to allow correct tooltip width calculations
|
||||
if (!tooltip.hasClass(placementClasses[0])) {
|
||||
@@ -176,7 +177,6 @@ angular.module('ui.bootstrap.tooltip', ['ui.bootstrap.position', 'ui.bootstrap.s
|
||||
}
|
||||
|
||||
// Take into account tooltup margins, since boostrap css draws tooltip arrow inside margins
|
||||
var ttPosition = $position.positionElements(element, tooltip, ttScope.placement, appendToBody, true);
|
||||
var initialHeight = angular.isDefined(tooltip.offsetHeight) ? tooltip.offsetHeight : tooltip.prop('offsetHeight');
|
||||
var elementPos = appendToBody ? $position.offset(element) : $position.position(element);
|
||||
tooltip.css({ top: ttPosition.top + 'px', left: ttPosition.left + 'px' });
|
||||
|
||||
Reference in New Issue
Block a user