Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Tooltip button moving when hover

Hover any button and you will see that it's moving by itself.
Why is this happening, is it a bootstrap bug?

HTML:

<div class="navbar-header" style="padding:4px 0 0 15px;">
  <button id="btnCadastrar" type="button" class="btn btn-default btn-sm" data-toggle="tooltip" data-placement="bottom" title="Cadastrar">
    <span class="glyphicon glyphicon-plus"></span>
  </button>
  <button id="btnEditar" type="button" class="btn btn-default btn-sm" data-toggle="tooltip" data-placement="bottom" title="Editar" style="margin-right:1px;">
    <span class="glyphicon glyphicon-edit"></span>
  </button>
  <button id="btnRemover" type="button" class="btn btn-default btn-danger btn-sm" data-toggle="tooltip" data-placement="bottom" title="Remover">
    <span class="glyphicon glyphicon-trash"></span>
  </button>
</div>

Bootply:
http://www.bootply.com/iYnzOb5GY4

like image 649
BernardoLima Avatar asked Dec 02 '14 18:12

BernardoLima


People also ask

How do you hover the button to show text?

The :hover selector is used to show the tooltip text when the user moves the mouse over the <div> with class="tooltip" .

How do I get the tooltip on the disabled button?

By default, tooltips will not be displayed on disabled elements. However, you can enable this behavior by using the following steps: Add a disabled element like the button element into a div whose display style is set to inline-block . Set the pointer event as none for the disabled element (button) through CSS.

Can we add tooltip on button?

Tooltip can be shown on Button hover and it can be achieved by setting title attribute.

What is button tool tip?

The tooltip, also known as infotip or hint, is a common graphical user interface (GUI) element in which, when hovering over a screen element or component, a text box displays information about that element, such as a description of a button's function, what an abbreviation stands for, or the exact absolute time stamp ...


1 Answers

Tooltips in button groups and input groups require special setting

When using tooltips on elements within a .btn-group or an .input-group, you'll have to specify the option container: 'body' (documented below) to avoid unwanted side effects (such as the element growing wider and/or losing its rounded corners when the tooltip is triggered).

– Bootstrap Explanation for Tooltips

Here what you need to change in your code

JS

$('[rel=tooltip]').tooltip({container: 'body'});

HTML

Add this attribute to your buttons

data-container="body"

Here is Bootply link

Example

like image 67
Ramiz Wachtler Avatar answered Nov 23 '22 17:11

Ramiz Wachtler