Twitter Bootstrap Tooltip not aligning correctly w

2019-02-22 00:21发布

When I have an element associated with a Twitter Bootstrap Tooltip and the Tooltip will overlap outside the browser window, it tries to realign within the window but it misaligns vertically (i.e. the top alignment of the tooltip is now centred rather than above the target element)

Has anyone encountered this before and if so, what was the work around/fix/update?

2条回答
兄弟一词,经得起流年.
2楼-- · 2019-02-22 00:52

Yes, others have encountered this before. For example, Issue #4125: Bad position of tooltip or Issue #3556: Tooltips near edge of window don't activate properly.

In the former it is suggested to either disable text wrapping or set a fixed height.

In the latter it is suggested (rather jestingly - but nevertheless potentially useful) to set a different positioning on tooltips you know are going to be near the window edge. E.g., placement: 'left' or placement: 'right'.

At this point there doesn't seem to be any impetus toward getting this handled in the repo.

查看更多
Root(大扎)
3楼-- · 2019-02-22 00:55

I have experienced this issue and found the following.

Caused the issue

<a href="https://www.facebook.com/ComfortEstatePlanning" data-toggle="tooltip" 
data-placement="bottom" title="" data-original-title="follow us on Facebook" 
><i class="fa fa-facebook-official fa-lg fa-2x pull-right"></i></a>

Note the pull-right class is on the i tag

<a href="https://www.facebook.com/ComfortEstatePlanning" data-
toggle="tooltip" data-placement="bottom" title="" data-original-
title="follow us on Facebook" class="pull-right"><i class="fa fa-facebook-
official fa-lg fa-2x"></i></a>

Solution is to put the pull-right class on the a tag

查看更多
登录 后发表回答