Skip to content
This repository was archived by the owner on May 29, 2019. It is now read-only.

fix(tooltip): Tooltip misplaced near right side #4311

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 14 additions & 7 deletions src/tooltip/tooltip.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,13 +132,20 @@ angular.module('ui.bootstrap.tooltip', ['ui.bootstrap.position', 'ui.bootstrap.b

var positionTooltip = function() {
if (!tooltip) { return; }

var ttPosition = $position.positionElements(element, tooltip, ttScope.placement, appendToBody);
ttPosition.top += 'px';
ttPosition.left += 'px';

// Now set the calculated positioning.
tooltip.css(ttPosition);

// Reset the positioning and box size for correct width and height values.
tooltip.css({ top: 0, left: 0, width: 'auto', height: 'auto' });

var ttBox = $position.position(tooltip);
var ttCss = $position.positionElements(element, tooltip, ttScope.placement, appendToBody);
ttCss.top += 'px';
ttCss.left += 'px';

ttCss.width = ttBox.width + 'px';
ttCss.height = ttBox.height + 'px';

// Now set the calculated positioning and size.
tooltip.css(ttCss);
};

var positionTooltipAsync = function() {
Expand Down