Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bootstrap tooltip hidden by parent div

I'm using Bootstrap tooltips on my web app and they were being cut off by it's parent div.

enter image description here

To solve this I added data-container="body"

<a href="/some-path" title="Show tool tip" data-container="body" data-toggle="tooltip">Hello</a>

This solved the problem but a new problem came with it.

When I click on the anchor and navigate the tooltip won't disappear.

Has anyone come across this? Is there a simple way to solve this?

EDIT - JSFiddle similar to my problem http://jsfiddle.net/m9AX5/5/ except in my case the parent div doesnt get removed.

like image 219
user3607282 Avatar asked Jun 07 '14 18:06

user3607282


1 Answers

It happens because the mouseleave isn't detected.

One solution is to hide tooltip on click action:

$('#button').on('click', function () {
  $(this).tooltip('hide')
})

Example: http://jsfiddle.net/m9AX5/6/

Hope it helps.

like image 51
André Augusto Costa Santos Avatar answered Sep 21 '22 18:09

André Augusto Costa Santos