Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ngx-bootstrap Tooltip - Not Dynamic Position

I have a tooltip controlled by ngx-bootstrap, rolling over an icon, a tooltip appears on the top of the icon.

This tooltip looks good if I maximize browsers, but if I minimize them a bit, the tooltip overlaps the icon, that I cannot click on the icon anymore likes the screenshot below:

enter image description here

Below is my code:

<span id="appCancelIcon" class="close-circle_red" tooltip="Cancel Changes" container="body"></span>

This tooltip is dynamic position, top and left values are different based on positions of icons.

I tried to edit in CSS likes below, then the tooltip became a static position. It doesn't matter where icons are, tooltips show in the same position.

.tooltip.top {
    padding: 5px 0;
    margin-top: -15px;
}

My question is How to make tooltips still have dynamic position and won't overlap icons?

Thanks!

like image 691
abcid d Avatar asked Jan 29 '26 13:01

abcid d


2 Answers

In your HTML code, along with tooltip, add placement property also.

<span id="appCancelIcon" class="close-circle_red" tooltip="Cancel Changes" placement="bottom" container="body"></span>

and then, adjust the css of tooltip.

::ng-deep{
  .bs-tooltip-bottom{
    margin-top: 2%;
  }
}

You can also change the placement to "top" and adjust the css of ".bs-tooltip-top" accordingly.

like image 78
Kamakshi Behl Avatar answered Jan 31 '26 05:01

Kamakshi Behl


Please try adaptivePosition="false" it may help you.

Not sure but I faced similar issue and it works for me!

All the best!

like image 33
Ambuj Khanna Avatar answered Jan 31 '26 05:01

Ambuj Khanna



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!